Catalog task State issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 11:38 AM
Hey Folks,
I'm facing an issue with my ServiceNow workflow, which includes two catalog tasks. When I close the first catalog task, the second one automatically gets closed as well. The same happens when a task is canceled. I need these tasks to function independently. Additionally, I want to set the RITM state based on the task statuses, If either of the tasks is canceled, the RITM should be set to closed cancelled or If both tasks are completed, the RITM should be set to closed complete.
Any help would be appreciated!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 11:43 AM
Hello @dmahendran
How have setup your flow or workflow? Is there any logic setup which cancel our other ctask did you check such br or script written exclusive for that catalog item?
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 12:01 PM - edited ‎03-17-2025 10:01 PM
I have set up a workflow where two catalog tasks are generated based on variable choices. The requirement is to ensure that if both tasks are completed, the RITM state updates to closed completed, whereas if either of the tasks is canceled, the RITM should be set to closed canceled. I attempted to achieve this using an if condition, but it is not functioning as expected. I need guidance on how to implement this logic correctly so that the RITM state updates accurately based on the status of the catalog tasks.
Attaching the snip below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2025 11:22 PM
Hello @dmahendran
In your workflow you have use join activity but it doesn't perform check whether all task are completed or is any one incomplete you will need additional if activity which will check what is status of all ctask, below is sample workflow in my PDI:
Script in If block after join activity is as followed:
answer = allCompleted();
function allCompleted(){
var completed = 0;
var count;
var grTask = GlideRecord('sc_task');
grTask.addQuery('request_item',current.sys_id);
grTask.query();
count = grTask.getRowCount();
while ( grTask.next() ){
if (grTask.getValue('state') === '3') {
completed++;
}
}
return count === completed ? 'yes' : 'no';
}
When any one ctask is mark as close incomplete the ritm goes in close incomplete state
If all Ctask are complete, then below is working:
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2025 12:28 AM
@Viraj Hudlikar Thanks for your response.
I didn’t implement any approval state before the "Request Approved" state in my flow, but I still see a "Waiting for Approval" stage appearing. I'm trying to figure out why this stage is showing up. I'll attach a snippet of the flow—let me know if you spot anything that might be causing this stage issue. When we raised the request i want the request state to be approved rather then showing as waiting for approval.