Adding ad hoc tasks which will
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 09:09 AM
Looking for some guidance. We have a few request workflows in our company that our Service Desk regularly have to raise "ad hoc tasks" during the lifecycle of the fulfilment should they require other teams to be involved.
Issue:
When the last WF task completes, the WF closes the RITM. That's all good. But now we are going to let users create ad-hoc tasks manually on the RITM. That means when the last WF task closes it will close the RITM and orphan the manually added tasks.
Looking for a business rule that if an ad hoc task is added that it will wait for all tasks to be close completed, closed incomplete, closed skipped and then the RITM will change the stage to Completed and state to Close Completed. See attached code I found and doesn't seem to work. Any help is much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 01:32 PM
Thank you for your quick response, one last clarifying question. For the filter condition could I use my example above for "all" my workflows under the service catalog? From your example it looks like I would need to list all of our items separately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 04:55 PM
Still not working after I selected my service catalog.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 11:55 AM
Hi Manmohan,
I came across this article since I have a similar use case. The only issue I ran into is that after I added the adhoc task via the RITM related list then complete both the regular task and adhoc task (in that order) the Request remained open. The request and RITM should go to 'Close Complete'.
See screen shot
Any suggestion as to why this is happening?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 01:54 PM
I had to add a "wait condition" in each workflow after my catalog task.
used advanced option.
// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
var tskRec = new GlideRecord("sc_task");
tskRec.addQuery('request_item', current.sys_id);
tskRec.addQuery('active', "true");
tskRec.query();
if (tskRec.next()) {
answer = false;
} else {
answer = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 02:01 PM
Thanks Julie. I too had a wait condition but the script was different. I used your script and it worked. Once again thanks for the assist.
Garfield