SCTask cancel when RITM is cancelled

Rocky5
Kilo Sage

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.

9 REPLIES 9

Hello Drew,

The history does not show "Closed Cancelled" and then "Closed Incomplete", It only shows "Closed Incomplete". any thoughts?

find_real_file.png

Thanks,

Rocky.

then you need to change it in OOB script

Thanks,
Shakeel Shaik 🙂

first find out where 'Closed Cancelled' script is running, then make changes as per your requirement

Thanks,
Shakeel Shaik 🙂

Well it was a possibility.  I still think that the workflow update is winning out over the business rule.  Is there some reason "Closed Incomplete" is not ok?

To eliminate the workflow as the possible culprit, set the order of your business rule to a value over 10,000, that will ensure it fires after the workflow has completed