- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 11:39 AM - edited 01-18-2023 11:48 AM
Hi All,
I have a catalog item workflow as below. Here the catalog tasks will be triggered through Run Script activity. And the issue is that the RITM is getting completed as soon the catalog tasks are created.
I want the RITM to get completed only after all the catalog tasks are Closed Complete.
Please assist me.
Thanks,
Priya.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 12:14 PM
You can use a wait condition and use the script here:
https://www.servicenowelite.com/blog/2016/3/4/wait-for-catalog-tasks-to-complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 12:14 PM
You can use a wait condition and use the script here:
https://www.servicenowelite.com/blog/2016/3/4/wait-for-catalog-tasks-to-complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 09:10 PM
Hi,
In your workflow, before X= set values activity, add one more activity called wait for condition, where you check the sc_tasks under this RITM are closed or not. you can refer below code and do some modifications.
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.addQuery('active', true);
gr.query();
if(gr.hasNext())
{
answer = false; // returning false as sc_tasks are active
}
else
{
answer = true; // Return true when no active sc_tasks
}
you can check if answer returning as true then close the RITM.