Add New State on Catalog Task: Workflow Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 04:06 AM
Hello Team,
This is regarding the new state on Catalog Task table.
Issue: Have added new state choice as 'Closed Cancelled (9)' under catalog task/task table. Now, when my workflow reaches the catalog task where I have two conditions i.e. Closed Complete: activity.result == 3 & Closed Cancelled: activity.result == 9
If user mark the task as closed complete no issue workflow works and goes to next activity BUT if user mark the task as closed cancelled then workflow gets stuck and doesn't move forward.
Troubleshooting:
1. Have checked with different closure states i.e. Closed Incomplete, Closed Skipped its working as these states are defined OOTB
2. Have checked one BR i.e. SNC - Run parent workflows + associated Script Include - TaskStateUtil().canRunParentWF(current) and added the new state but it doesn't work.
ScreenShot:
1. Task state:-
2. Sample Workflow - Have created to check the conditions:-
Has anyone done these changes in your engagements. If yes, can you please provide solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 04:20 AM
refer below links for help
Workflow Catalog Task condition(s)
Workflow not progressing after catalog task closure and stuck at Catalog Task activity
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 04:26 AM
Hello Ankur,
Thank you for your quick response. But have already checked these post earlier and these doesn't help as I am creating new state and through which applying the condition which is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 04:36 AM
one other alternative you can try
1) Use Workflow wait for condition and script below to check if that particular task got inactivated or not
answer = checkCondition();
function checkCondition() {
var scTask = new GlideRecord('sc_task');
scTask.addQuery('request_item', current.sys_id);
scTask.addQuery('short_description', 'Your Short Description');
scTask.addQuery('active', false);
if(scTask.next()){
return true;
}
return false;
}
2) Then have after update BR on sc_task to mimic update happened on RITM and make the workflow trigger forward
Condition:
State Changes to Your New State AND current.request_item.cat_item.name == 'Your Catalog Item Name Here'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
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);
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 04:57 AM
Hello Ankur,
Thank you for your quick response.
Just few questions:-
1. Why we are using Wait Condition as what we need to achieve from this and do we require return True or False. I mean do we need Active - false or true. Sorry didn't get this wait for condition logic.
2. After Br on Update operation under ScTask table and using this method - broadcastEventToCurrentsContexts to make the workflow proceed further. Is that correct understanding?