Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Incident and interaction closure

Nawal
Mega Guru

Hello

I have an issue, when I close an incident, the interaction related to that incident does not close, where do I check this please.

 

 

 

1 ACCEPTED SOLUTION

Ok,

 

Then the BR is on Incident table. After - Update

Condition: incident is closed

Script:

ar gr = new GlideRecord('interaction'); //check table name
gr.addQuery('sys_id', current.u_interaction);
gr.addQuery('active', true);
gr.query();
while(gr.next())  //if there is only 1 interaction, you can use if instead of while
{
gr.state = 3; //check closure state value
gr.comments = 'Interaction Closed'; //optional
gr.update();
}
-Anurag

View solution in original post

10 REPLIES 10

Cool. Then you want to close the all incident when the interaction is closed

The below should be a BR on Interaction (running after update, condition: interaction state changes to closed)

var gr = new GlideRecord('incident')
gr.addQuery('u_interaction.sys_id', current.sys_id);
gr.addQuery('active', true)
gr.query();
while(gr.next())
{
gr.incident_state = 3;
gr.comments = 'Interaction Closed'; //optional
gr.update()
}

 

-Anurag

-Anurag

Thank you Anurag,

 

for example those are attached 

find_real_file.png

to this Interaction

 find_real_file.png

if states of both incident and req passed to close ==> interaction state = closed 

Im Sorry , im confused. Park request for now and talk about incident

What is closing what?

Interaction is closing incident or incident should close interaction?

-Anurag

Incident should close interaction 🙂

Ok,

 

Then the BR is on Incident table. After - Update

Condition: incident is closed

Script:

ar gr = new GlideRecord('interaction'); //check table name
gr.addQuery('sys_id', current.u_interaction);
gr.addQuery('active', true);
gr.query();
while(gr.next())  //if there is only 1 interaction, you can use if instead of while
{
gr.state = 3; //check closure state value
gr.comments = 'Interaction Closed'; //optional
gr.update();
}
-Anurag