Is it possible to pause a workflow? Can a workflow be paused from within a UI action?

Edwin Fuller
Tera Guru

I need to pause all running workflows using an UI action when the status changes to "IT Record Opened" and then resume the workflow when the status changes from   "IT Record Opened". Can someone show me how this would be done. If there's another option for me to pause the workflow, I'm open to looking at those suggestions as well.

Thanks

Current UI Action

function addITnumber(){

  g_form.setDisplay('it_record', true);

  g_form.setMandatory('it_record', true);

if(g_form.getValue('it_record')==''){

  try {g_form.hideFieldMsg('it_record');} catch(e) {}

      g_form.setMandatory('it_record', true);

      g_form.showFieldMsg('it_record','Enter Idea, Demand or Service Request Ticket # to proceed.');

}

  gsftSubmit(null, g_form.getFormElement(), 'ITnumber');

}

//Ensure call to server-side function with no browser errors

if (typeof window == 'undefined')

  serverResolve();

function serverResolve(){

current.current_status = ('IT Record Opened');

current.update();

}

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi Edwin,



You could run the following script   to restart the workflow:



var i = new GlideRecord('table name');


if (i.get("sys_id", "record sysid"))


{


new Workflow().restartWorkflow(i,true);


i.comments='true wf restart';


i.update();


}



Regards,


Sachin


View solution in original post

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

Hi Edwin,



What do you mean by Pausing the workflow,



What you can simply do is add a 'wait for condition' activity in the workflow and that condition happens only onclick of a button or whatever you want, this way you can easily hold the workflow from moving forward. Is this what you want to achieve?


-Anurag

hi Anurag,


I'm trying to do the same thing but having issues as well.


i want to stop the change order workflow from moving to "complete" status until all change tasks are complete.   i tried adding a 'wait for cond' box and a 'set value' to pending box but nothing works.   the order still goes to complete when user moves it.   what am i doing wrong or what is the format i should be using?



thx


Khaled


SanjivMeher
Kilo Patron
Kilo Patron

Hi Edwin,



Do you want to pause the workflow at any particular step?


If Yes, then you can add a wait for condition on that particular step.



But if you want to pause any stage of workflow, you will have to put wait condition always. Thats difficult



Please mark this response as correct or helpful if it assisted you with your question.

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi Edwin,



You could run the following script   to restart the workflow:



var i = new GlideRecord('table name');


if (i.get("sys_id", "record sysid"))


{


new Workflow().restartWorkflow(i,true);


i.comments='true wf restart';


i.update();


}



Regards,


Sachin