- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2025 10:02 PM
Can anyone suggest a workflow to handle this scenario: When a catalog item is created, it generates a Request Item (RITM) and a Service Catalog Task (SCTASK). If the SCTASK is closed, the RITM should close automatically. If the SCTASK is skipped, the RITM should also be skipped automatically."
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2025 08:56 PM
you can use after update business rule on SC Task table
Condition: current.request_item.cat_item.name == 'Your Item'
Script:
(function executeRule(current, previous /*null when async*/) {
// Get the RITM associated with the SCTASK
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
if (current.state == '3') { // Closed Complete
ritm.state = '3'; // Closed Complete
ritm.update();
} else if (current.state == '7') { // Skipped
ritm.state = '7'; // Skipped
ritm.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
05-04-2025 04:51 PM
Greetings,
Would you consider a Business Rule instead of a Flow for this request? The reason I ask this is because when you go into Flow Designer the RITM table [sc_req_item] is NOT available to pick as the Trigger condition (screenshot included).
If you still prefer the Flow Designer approach you could create a Business Rule that establishes the trigger condition and then use the Flow API to call a Subflow that handles the state change. It would be one less step if you created JUST the Business Rule and used it for the trigger condition AND to handle the actual State change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2025 05:08 PM
Apologies as I was starting from the RITM table and not the SCTASK table. This should be possible in Flow Designer.
You could build your Trigger condition to be more specific if you desire to do so. Then you can use the "Update Record" Flow Action.
Within the "Update Record" Flow Action step, click on the data-pill picker next to the Record field and dot-walk to the parent record of the Trigger record.
I hope this answers your question and, as always, look forward for other's opinions for possible solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2025 08:56 PM
you can use after update business rule on SC Task table
Condition: current.request_item.cat_item.name == 'Your Item'
Script:
(function executeRule(current, previous /*null when async*/) {
// Get the RITM associated with the SCTASK
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
if (current.state == '3') { // Closed Complete
ritm.state = '3'; // Closed Complete
ritm.update();
} else if (current.state == '7') { // Skipped
ritm.state = '7'; // Skipped
ritm.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