SCTask cancel when RITM is cancelled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 10:44 AM
Hello Experts,
I have written the below BR on RITM table to cancel active catalog tasks when RITM is cancelled. But, Though the value of "Closed Cancelled" state is '12', The below script executes but sets SCtasks to "Closed Incomplete" instead of "Closed Cancelled". I removed "Closed Incomplete" state from the choice list of sctasks but still the "Closed Incomplete" is being set after the below BR is executed.
var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item', current.sys_id);
sctask.addActiveQuery();
sctask.query();
while(sctask.next()){
sctask.state = '12';
}
How can I achieve this and set sctask state as "Closed Cancelled" instead of "Closed Incomplete"?
Thanks,
Rocky.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 10:50 AM
Could you right click the state field on an SC task record and select 'Show Choice List' and post a screenshot? If possible, add a filter so that we can see all of the available options for that specific field.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 11:16 AM
sctask.setValue('state', 12);
Shakeel Shaik 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 11:13 AM
When a workflow is canceled any open tasks that were created by a workflow activity will get marked as "Closed Incomplete". Its the workflow process that does it so I suspect that if you look at the history of the catalog task you will see it get marked as "Closed Canceled" and then "Closed Incomplete".