How to re-process workflow activity or rollback to specific activity on an active workflow.

Stephen W_
Giga Guru

I understand how to do this in workflow design, but I need to salvage a bunch of stuck requests.

There is a workflow activity script with multiple conditions, none of them default/else.

The variable this activity used did not exist on a number of request items.

I've added the variable to all of the request items via script, and was hoping I could just re-broadcast a workflow update to get them to continue..

I was wrong.

Has anyone had any success with this?  

I've tried manipulating the activity history, transitions, and executing activities with no success other than making the workflow viewer at least looks like it's evaluating..

If I could roll back to the previous activity, that would be just as good..

I'd rather not have the users cancel and redo these.

Thanks,

-Stephen

2 REPLIES 2

Ken83
Mega Guru

If you can target all of the records via script, you should be able to just renew the workflow context. I use this script in one of my UI Actions to restart a workflow for either a REQ or RITM so that we don't have to make users re-submit when issues arise.



// This is from the RITM level


startWorkflow(current.cat_item.workflow);


action.setRedirectURL(current);




function startWorkflow(id) {


  var w = new Workflow();


  var context = w.startFlow(id, current, current.operation('update'), getVars());


  if (context != null)


  current.context = context.sys_id;


}




/**


* Get the variables from the request item so that we can map these to the workflow.input


* variables if the names match.


*/


function getVars() {


  var vars = {};


  for (var n in current.variables)


  vars[n] = current.variables[n];



  return vars;


}


Thanks Ken,



I've used a similar script to speed up testing.



Unfortunately, approvals as well as a number of tasks have already taken place on these workflows, so I didn't want to have them start from the beginning.   My goal here was to reset just the current or previous activity, not the entire workflow..