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

Kavita_Bhojane
Tera Guru

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;

}