- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 09:03 AM
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.
Solved! Go to Solution.
- Labels:
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 02:11 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2020 08:52 AM
Hello Anurag,
thank you for your help,
you script works.
I tried this with my collegue and it works too:
(function executeRule(current, previous /*null when async*/) {
var result = [];
var array = [];
var ref = [7,3];
var gr = new GlideRecord ('task');
gr.addQuery('u_interaction',current.u_interaction);
gr.query();
while (gr.next())
{
array.push(gr.state);
}
if(array.length > 0)
{
for(var i=0;i<array.length;i++)
{
var arrayUtil = new ArrayUtil();
if(arrayUtil.indexOf(ref, array[i])==-1)
{
result.push(array[i]);
}
}
}
if(result.length == 0)
{
var inter = new GlideRecord ('interaction');
inter.addQuery('sys_id',current.u_interaction);
inter.query();
if(inter.next())
{
inter.state='closed_complete';
inter.update();
}
}
})(current, previous);