- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
15 hours ago
we have a requirement, when the incident or request is closed, automatically the interaction record needs to close. Already we have a Ui button in SOW interaction form, when we click the button in the interaction form, the incident or request will create. here in incident the associated interaction record is updating in the work notes. now the client wants additional changes which i mentioned in the first line. how can we achieve, please help with the process and the script.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
HI @suryaogeti1 ,
1.The configuration should be like this , add filter conditions as per requirement
2.Script:
(function executeRule(current, previous /*null when async*/) {
var gr=new GlideRecord("interaction_related_record");
gr.addQuery("document_table","sc_request"); //updated table name
gr.addQuery("document_id",current.sys_id);
gr.query();
if(gr.next())
{
var interaction=new GlideRecord("interaction");
if(interaction.get(gr.getValue("interaction")))
{
interaction.state="closed_complete";
interaction.update();
}
}
})(current, previous);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @Rakesh_M
will it work for both incident and request right..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @suryaogeti1 ,
It will work only for incident if you want same for request create a BR on request table and change table name in script from incident to sc_request
I found an alternative approach where a interaction is closed immediately after creating a incident/request from interaction
refer:https://www.servicenow.com/community/itsm-forum/interaction-to-be-automatically-closed-when-it-gets-...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi @suryaogeti1 ,
It only works for incident,For request you need to create another BR and update the table name in the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10 hours ago
Hi @Rakesh_M
Need to change only table name right, rest all will be same
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
HI @suryaogeti1 ,
1.The configuration should be like this , add filter conditions as per requirement
2.Script:
(function executeRule(current, previous /*null when async*/) {
var gr=new GlideRecord("interaction_related_record");
gr.addQuery("document_table","sc_request"); //updated table name
gr.addQuery("document_id",current.sys_id);
gr.query();
if(gr.next())
{
var interaction=new GlideRecord("interaction");
if(interaction.get(gr.getValue("interaction")))
{
interaction.state="closed_complete";
interaction.update();
}
}
})(current, previous);