Set WF sctask to close complete instead of close incomplete after STD change was closed.

olufsen
Kilo Sage

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?

 

olufsen_0-1697253596863.png 

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();
    }
}

olufsen_1-1697253813464.png

 

 

1 ACCEPTED SOLUTION

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

View solution in original post

5 REPLIES 5

Danish Bhairag2
Tera Sage
Tera Sage

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

 

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.

 

olufsen_0-1697262131699.png

 

 

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

This one worked! Thank you.