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-08-2020 08:31 AM
Thank you so much:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:54 AM
Hello All,
It seems there is limitation here from ServiceNow end. So to achieve the business requirement, have write the below logic through Business Rule.
After - Update Operation
Condition - State changes to Closed Cancelled And *Add more based on your requirement*
Script:-
var getRITM = current.request_item;
//Cancel RITM and associated workflow
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('sys_id',getRITM);
grRITM.query();
if(grRITM.next()){
grRITM.active = false;
grRITM.state = 9;
var workflow = new Workflow();
workflow.cancel(grRITM);
grRITM.setWorkflow(false);
grRITM.update();
}
//Cancel Any Active Open Task
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item',getRITM);
grTask.addQuery('sys_id','!=',current.sys_id);
grTask.addActiveQuery();
grTask.query();
if(grTask.next()){
grTask.state = 3;
//grTask.active = false;
//grRITM.setWorkflow(false);
grTask.update();
}
current.active = false;
current.setWorkflow(false);
current.update();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Ishan