- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 01:17 AM
Hi Experts, In Sow View , When an interaction is created and then converted to other ticket types such as incident, change, request and problem. When these tickets are complete, the interaction should also be marked as complete.
I Created BR for this requirement but is not working. Please help me on this
Thanks
Script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 06:22 AM
you can use after update business rule on Task table.
Whenever INC/PRB/CHG is created from interaction, an entry is made into this table "interaction_related_record"
You can use this table to know which interaction to close when INC/PRB/CHG is closed
Business rule: task table
Condition:
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("interaction_related_record");
gr.addQuery("task", current.sys_id);
gr.query();
if (gr.next()) {
var interactionRec = gr.interaction.getRefRecord();
interactionRec.state = 'closed_complete';
interactionRec.active = false;
interactionRec.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 06:14 AM
so what debugging did you do in that business rule?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 06:22 AM
you can use after update business rule on Task table.
Whenever INC/PRB/CHG is created from interaction, an entry is made into this table "interaction_related_record"
You can use this table to know which interaction to close when INC/PRB/CHG is closed
Business rule: task table
Condition:
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("interaction_related_record");
gr.addQuery("task", current.sys_id);
gr.query();
if (gr.next()) {
var interactionRec = gr.interaction.getRefRecord();
interactionRec.state = 'closed_complete';
interactionRec.active = false;
interactionRec.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 07:27 AM
Hi @Ankur Bawiskar ,
Thank you so much your response , This script is working as per expectation. once again thankyou.
I have one more question.-https://www.servicenow.com/community/developer-forum/sow-quick-links/m-p/3286535 , please help on this question also.