- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 01:58 AM
Hi Team,
I'm able to close the RITM when SCTASK is "closed complete". But, at the sametime if SCTASK is "closed incomplete" how to make RITM state "cancelled" using flow designer?
Regards,
Ash
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 03:01 AM
Hi,
then do this in the BR
Condition: State Changes to Closed Incomplete
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritm = current.request_item.getRefRecord()'
ritm.state = 'cancelled';
ritm.update();
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 02:02 AM
Hi,
Ideally you should close the RITM once the last SC Task for that RITM is completed.
I would suggest to use after update BR on sc_task table
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 02:13 AM
Hi Ankur,
As we have many catalog items with flow designers for each, I think it is good idea to have an BR for cancelled state SCTASK to update RITM.
Can you please help with script for BR?
Regards,
Ash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 02:19 AM
Hi,
Once all sc tasks are closed for the RITM; RITM will be marked complete
You can have after update BR on sc_task
Condition: Active Changes to False
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.request_item);
gr.addQuery('active', true);
gr.query();
if(!gr.next()){
var ritm = current.request_item.getRefRecord();
ritm.state = 3;
ritm.update();
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2021 02:25 AM
Hi Ankur,
Can I use this above script for SCTASK "closed incomplete" to change RITM state to "cancelled"?
Regards,
Ash