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

Kalaiarasan Pus
Giga Sage

Check about the wait for condition activity on the workflow. It would do what you are looking for. You can find multiple examples of it in the community.