- 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-14-2023 03:59 AM
Hi @olufsen,
You should either use join or wait for condition.
Script for wait for condition:
answer = true;
var grCatTask = new GlideRecord('sc_task');
grCatTask.addQuery('request_item', current.sys_id);
grCatTask.addActiveQuery();
grCatTask.query();
if(grCatTask.next()){
answer = false;
}
else{
answer = true;
}