Service Manager / Service Center Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Unable to resolve interaction ticket post related incident gets resolved.

Frequent Advisor

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

 

 

 

3 REPLIES
Valued Contributor

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 Honored Contributor

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.

Highlighted
Honored Contributor Honored Contributor

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.