change workflow activity execution state

amaradiswamy
Kilo Sage

Hi All,

In my workflow join activity i forgot to change the condition activity.result == complete, my workflow designed as shown in screenshot

find_real_file.png

so, the condition didn't match in if activity and hence directly joined to JOin activity and so even task1, task2 completed, the workflow got struck as condition didn't match. so, i need to move the workflow to further steps. How can i do that?

I tried the below, it sets join activity status to finished but it is not going to next steps. Please advice.

var gr = new GlideRecord('wf_executing');

gr.addQuery('sys_id','sysidof thw activityfromcontext');

gr.query();

if(gr.next())

{

gr.state = 'finished';

gr.update();

}

Thanks and regards,

Swamy

11 REPLIES 11

The script seems ok.



I have this one here on my backlog of used scripts, but I think it's the same as you have:



var w = new Workflow();


var contextGR = new GlideRecord('wf_context');


contextGR.addQuery('id', 'a7a94f090f8a2240c7a0de2be1050e1d'); // sys id of the requested item


contextGR.query();


while( contextGR.next() ) {


var activityGR = new GlideRecord('wf_executing');


activityGR.addQuery('context', contextGR.sys_id);


activityGR.addQuery('activity.name', 'Task 1'); // replace with your activity name "Join"


activityGR.query();


while( activityGR.next() ) {


  activityGR.state = 'finished';


  activityGR.update();


}


}



Maybe because it's a "Join" activity.



Telmo


amaradiswamy
Kilo Sage

could anyone please help me on this?



Thanks and regards,


Swamy