Re: Unable to resolve interaction ticket post related incident gets resolved. (209 Views)
Reply
Advisor
pvijay1
Posts: 35
Registered: ‎11-25-2013
Message 1 of 4 (235 Views)

Unable to resolve interaction ticket post related incident gets resolved.

Hi Team,

 

We have written triggers to resolve interaction automcatically when related incident ticket gets resolved. Pls see below script which we have written:

 

***********************************************************

var

file=system.vars.$file;

if

(file.problem_status=="Resolved")

{

var fRelation=newSCFile("screlation");

var RelRes=fRelation.doSelect('source="'+file.number+'" and source.filename="problem" and depend.filename="incidents" and depend.active="true"');

if(RelRes==RC_SUCCESS)

{

do

{

var fIncidents=newSCFile("incidents");

var IncRes=fIncidents.doSelect('incident.id="'+fRelation.depend+'"');

if(IncRes==RC_SUCCESS)

{

fIncidents

.open="Resolved";

fIncidents.doUpdate();

}

}while(fRelation.getNext()==RC_SUCCESS)

}

}

 

***********************************************************

 

We have written this script in probsummary table, in before update.

However, this trigger behaves abnormally. When we resolve incident, the related interaction status changes to resolved for once, but after some time the same  interaction's status changes back to Open-Linked automatically. We have to save the incident and interaction again to resolve this error.

 

Please suggest a way to overcome this error and also kindly highlight the mistake we are doing in the triggers.

Need an urgent response on this.

 

Thanks in advance,

 

Regards,

PV

 

 

 

Regular Advisor
ArpitAggarwal07
Posts: 104
Registered: ‎09-10-2013
Message 2 of 4 (232 Views)

Re: Unable to resolve interaction ticket post related incident gets resolved.

Hi

 

Should'nt the trigger run after the update? Why are you executing  the trigger before update .

 

Regards

AA

Honored Contributor
Vadim Gorda
Posts: 5,781
Registered: ‎11-10-2008
Message 3 of 4 (223 Views)

Re: Unable to resolve interaction ticket post related incident gets resolved.

Hello,

Below 2 portions of script are working?

var RelRes=fRelation.doSelect('source="'+file.number+'" and source.filename="problem" and depend.filename="incidents" and depend.active="true"');

 

and

 

 

var IncRes=fIncidents.doSelect('incident.id="'+fRelation.depend+'"');

 

I have not used ' in scripts .  in my understanding it must have been

 

var IncRes=fIncidents.doSelect('incident.id=\""+fRelation.depend+"\"");

 

 

Also you are using the OOB status field which is set based on OOB logic to proper status after related Incident is closed. You will have to try trigger on post update (change from Before Update)  which might not work.

 

The easiest way to achieve this will be to add a custom field to manage your custom status and set it to required values at any moment you want.

Honored Contributor
Piku
Posts: 4,013
Registered: ‎06-17-2010
Message 4 of 4 (209 Views)

Re: Unable to resolve interaction ticket post related incident gets resolved.

Hi,

As Vadim suggested it is because of OOB status as interaction might be updated in background if linked to any incident.
It is better, if you set the Interaction status to close instead of resolved.

hth,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.