- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 02:20 PM
I would like to develop a flow for RITM, so that when the last task is completed, it automatically closes the RITM. How can I do that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 12:46 AM
1. Navigate to Flow Designer in ServiceNow.
2. Click on "New" to create a new flow.
3. Set the trigger for the flow as "When record is updated" and select the table as "sc_task".
4. Set the condition for the trigger as "Task State changes to Closed Complete".
5. Add an action to "Look up Record" from the "Requested Item [sc_req_item]" table where "Requested Item is the parent of the Task".
6. Add a decision to check if "All child Tasks of the Requested Item are in Closed Complete state".
7. If true, add an action to "Update Record" and set the "State of the Requested Item to Closed Complete".
Decision Script:
(function executeRule(current, previous /*null when async*/) {
var task = new GlideRecord('sc_task');
task.addQuery('request_item', current.sys_id);
task.addQuery('state', '!=', '3'); // 3 is the value for Closed Complete
task.query();
return !task.next(); // returns true if no records found
})(current, previous);
Please mark it Correct and Hit Like if you find this helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 12:46 AM
1. Navigate to Flow Designer in ServiceNow.
2. Click on "New" to create a new flow.
3. Set the trigger for the flow as "When record is updated" and select the table as "sc_task".
4. Set the condition for the trigger as "Task State changes to Closed Complete".
5. Add an action to "Look up Record" from the "Requested Item [sc_req_item]" table where "Requested Item is the parent of the Task".
6. Add a decision to check if "All child Tasks of the Requested Item are in Closed Complete state".
7. If true, add an action to "Update Record" and set the "State of the Requested Item to Closed Complete".
Decision Script:
(function executeRule(current, previous /*null when async*/) {
var task = new GlideRecord('sc_task');
task.addQuery('request_item', current.sys_id);
task.addQuery('state', '!=', '3'); // 3 is the value for Closed Complete
task.query();
return !task.next(); // returns true if no records found
})(current, previous);
Please mark it Correct and Hit Like if you find this helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 08:20 AM
Thanks for solution Karthiga S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 12:53 AM
No action needed you on this as there is an oob business rule (task closer )which will close the ritm.
Regards,
Luxo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 12:59 AM
Greetings!!
To do this, just check the OOTB Flow / workflow.
https://INSTANCENAME.service-now.com/workflow_ide.do?sysparm_nostack=true&sysparm_use_polaris=false
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************