Business Rule to Close Catalog Tasks when the parent Requested Item is closed automatically via API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi,
I have been tasked with creating a business rule that will close associated catalog tasks when the parent RITM has been closed via an API Integration.
I was wondering if anyone had ideas around the best way forward, whether there is something simply other than a script.
The scenario is that a RITM has been created and has associated catalog tasks. We have integrations that interact and generate these RITM and now will close them. When we close them we need the associated tasks to be close out post RITM closure.
The API making the call will have the prefix svc_ within it's user name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Greetings @simonellis. You can do a pretty simple Business Rule if you want to take the pro-code approach. If you are more comfortable with ServiceNow's low-code solutions, you could also create a Flow. I found a very similar existing Business Rule called "Close Tasks Due to Cancellations" that you can use as a template to create your new Business Rule. I hope this information is helpful!
When: after
Insert: true
Update: true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
you can use after update business rule on RITM
Condition: State Changes to Closed Complete/Close Incomplete/Close Skipped AND Item == <Your Item Name>
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.sys_id);
gr.query();
while (gr.next()) {
gr.state = 3;
gr.update();
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader