'Withdraw' facility in Change Ticket

varunp
Tera Guru

Hi All,

We want to implement 'withdraw' facility in change ticket.

Now what is 'withdraw' facility? if the end user has submitted the change for approval, and at some point he decided he don't want to do this change now, then he will 'withdraw' the change which will reset all the approvals and change the state back to OPEN and approval to 'Not yet requested'. And in future user should again submit the same change ticket when he is ready.

Any idea how to implement this requirement?

Regards,

Varun

1 ACCEPTED SOLUTION

manikorada
ServiceNow Employee
ServiceNow Employee

Varun,



You can make use of restart Workflow option for this. check this http://wiki.servicenow.com/index.php?title=Workflow_Script#restartWorkflow.28current.2C_maintainStat...


So, you can have   a script in UI action/Business rule and have the following script:


var comment = 'This changes is withdrawn';


new WorkflowApprovalUtils().cancelAll(current, comment);


new Workflow().restartWorkflow(current);


View solution in original post

2 REPLIES 2

manikorada
ServiceNow Employee
ServiceNow Employee

Varun,



You can make use of restart Workflow option for this. check this http://wiki.servicenow.com/index.php?title=Workflow_Script#restartWorkflow.28current.2C_maintainStat...


So, you can have   a script in UI action/Business rule and have the following script:


var comment = 'This changes is withdrawn';


new WorkflowApprovalUtils().cancelAll(current, comment);


new Workflow().restartWorkflow(current);


In addition to what Mani Kanta Korada has said, you would need to add a new state value as "Withdrawn". Put the change in this new state on click of UI Actiton, and put an if condition before approvals in your workflow, that would allow the workflow to go to approvals again only if the state is not "Withdrawn".