Reopen cancelled request

rev3
Mega Expert

How to reopen cancelled Request.

I am changing request state and stage and setting the workflow to true using the below script:

var gr= new GlideRecord('sc_request')

gr.addQuery('sys_id', 'sample sys_id');

gr.query();

while(gr.next()) {

gr.request_state="pending";

gr.setWorkflow(true);

gr.update();

}

But the workflow is not setting back. Is there a way to run the workflow again.

Thank You

1 ACCEPTED SOLUTION

Rather than gr.sys_id, it expects the GlideRecord object.



var gr= new GlideRecord('sc_request')


gr.addQuery('sys_id', 'sample sys_id');


gr.query();


while(gr.next()) {


        gr.request_state="pending";


  new WorkflowApprovalUtils().cancelAll(gr, "comment");


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


        gr.update();



}


View solution in original post

10 REPLIES 10

Rather than gr.sys_id, it expects the GlideRecord object.



var gr= new GlideRecord('sc_request')


gr.addQuery('sys_id', 'sample sys_id');


gr.query();


while(gr.next()) {


        gr.request_state="pending";


  new WorkflowApprovalUtils().cancelAll(gr, "comment");


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


        gr.update();



}


Hello Chuck,



I am able to run the workflow now . I tried to restart the requested Item workflow the same way but it is not running.



Is there a way i can achieve this.




Thank You


Have you tried running this script in Scripts - Background to see if there is any output worth noting?


Hi Chuck,



Sorry for the delay in response. I was able to restart the requested itemas well by setting the stage to waiting for approval. The cascade workflow business rule on the request is checking if the RITM stage is waiting for approval.



Thank You


Michael Fry1
Kilo Patron

Check out the inactive business rule named: SNC Approval - Reset conditions


the rule contains details about how to reset the workflow, and a section on what is the reset conditions.



I've used this and it works great!