- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 09:34 AM
when the state of the catalog task related to an RITM is changed to closed cancelled The Work flow is still executing
How to stop the work flow if the state is changed to closed cancelled
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 09:57 AM
The best way to do this is to add Conditions on this specific task on the workflow, or create a business rule if you want any task that is Closed Incomplete/cancelled to cancel the RITM. When an RITM is Closed Incomplete, there are out of the box Business Rules in place to close incomplete any other open tasks and cancel the workflow. To add Conditions, right-click on the task activity, and choose Add Condition. You should have one condition for each inactive catalog task state, so out of the box that's Closed Complete (3), Closed Incomplete (4), and Closed Skipped (7). Give the condition a Name, then in the Condition field type activity.result==3 for Closed Complete.
Repeat to add the other conditions, then right-click directly on the Always condition and choose Delete. Now all you have to do is route the paths accordingly - you may want to continue on to the next task/activity if Closed Complete, and maybe Closed Skipped too, and point to an activity that makes the RITM Closed Incomplete if the task is Closed Incomplete.
In this example the Set Values activity is setting the (RITM) State = Closed Incomplete, Active = false, and the Stage to Complete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 10:44 AM
Yes i have added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 12:56 PM
OK, we're almost there. I mocked this up in my PDI, and what is happening is that the RITM workflow is not being triggered when the task is updated like it does with the out of the box task closed states. You can determine this by manually updating the RITM after you have closed cancelled this task. You will then see the workflow move forward. So what you need is an after Update Business Rule running on the sc_task table with the Filter Condition State changes to Closed Cancelled. Your Script on the Advanced tab should look like this
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.request_item);
gr.query();
if (gr.next()) {
new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 07:20 PM
Thank you Brad Bowman for your help ,Its working now the workflow is successfully executing and it is stopping
Thank you,
Gowtham Kodali.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2020 08:03 PM
Hi, I tried this in my work instance there it is not working but in my personal instance it is fine the work flow is stopping
but in my work instance the flow is still executing i have done all the steps mentioned, Is there any other things I have to consider
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2020 02:47 AM
No, you should just have to add the State choice, modify the TaskStateUtil Script Include, create the new Business Rule, and add the conditions to the task - the same as you did in your instance.