- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 08:28 PM
Hi, anybody can help me how to set the cancelled task to Closed Complete instead of Closed Incomplete after closing the STD change? I even put another run script to force the state change, but it didn't work. How can I implement this?
updateRITMtask();
function updateRITMtask() {
var sctask = new GlideRecord('sc_task');
sctask.initialize();
sctask.addQuery('request_item', current.sys_id);
sctask.addActiveQuery();
//sctask.addQuery('state',4);
sctask.query();
if (sctask.next()) {
sctask.state = 3;
sctask.work_notes = "Associated Standard Change has been completed";
sctask.update();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 07:02 AM - edited 10-14-2023 07:03 AM
Hi @olufsen ,
In your original pic where u shared the problem, please add the join after the Run Script "Close Task" n check. I think this should work.
Reason is because "Join" will make sure the parallel activity does not get cancelled & you Run script activity "Close Task" will do it's magic to close complete the sc task.
Mark my answer as helpful & accepted if it helps you resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 09:56 PM - edited 10-13-2023 09:58 PM
Hi @olufsen ,
You don't have to use run script for that, from the pic I could see a branch was created for a catalog task & run script so for every branch to close we should use "Join" activity which we can find under core.
Add the Join activity instead of Run script "Close Task" and execute n check .It should work as expected. It will wait for that task to get Closed .once closed then only it will move fwd.
Mark my answer helpful & accepted if it helps you resolve your issue.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2023 10:42 PM
Hi @Danish Bhairag2 , I tried your approach but it did not pushed to auto-close the sctask. It gets stuck. My requirement is that when the STD change is closed, it will also close the sctask and RITM. My initial WF did close the RITM but the sctask state is Closed Incomplete, it should be Closed Complete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 07:02 AM - edited 10-14-2023 07:03 AM
Hi @olufsen ,
In your original pic where u shared the problem, please add the join after the Run Script "Close Task" n check. I think this should work.
Reason is because "Join" will make sure the parallel activity does not get cancelled & you Run script activity "Close Task" will do it's magic to close complete the sc task.
Mark my answer as helpful & accepted if it helps you resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 12:32 PM
This one worked! Thank you.