WF send back to requestor

HenryD
Tera Guru

Hello, running into a issue where im having trouble resetting the values in the workflow.

 

for example, once the RITM is deep in the WF i send it back and goes back to the user it then goes back in the workflow and starts from the begining, right now im having trouble resetting/changing the values within those tasks "approval" "state" those values are staying approved however i want those to reset back to either pending or rejected. ive tried to use the "Set Values" within the WF but i have had zero luck so far. 

1 REPLY 1

Mike_R
Kilo Patron
Kilo Patron

Maybe you can mimic what's in the "Change Request - Normal" workflow. There's a run script to disassociate approval records

Mike_R_0-1666380093079.png

 

 

var existingApprovalsGr = new GlideMultipleUpdate("sysapproval_approver");
existingApprovalsGr.addQuery("sysapproval", current.getUniqueValue());
existingApprovalsGr.addQuery("state", "!=", "cancelled");
existingApprovalsGr.setValue("wf_activity", "");
existingApprovalsGr.execute();

existingApprovalsGr = new GlideMultipleUpdate("sysapproval_group");
existingApprovalsGr.addQuery("parent", current.getUniqueValue());
existingApprovalsGr.addQuery("approval", "!=", "cancelled");
existingApprovalsGr.setValue("wf_activity", "");
existingApprovalsGr.execute();