Override approval state on rejection

sigmachiuta
Kilo Guru

In my workflow when an approval is rejected I am setting the approval state to escalate rejected, but when the workflow goes through the approval, and it is rejected the approval state is rejected.   Why cant I set the value of the approval state field?

1 ACCEPTED SOLUTION
5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

HI,



Can you please share screenshot of your workflow.


I guess the question is are there OOB business rules that set the approval state after the approval workflow block that would override a set value workflow block after an approval rejection.   If so why wouldn't I be able to set a value on the approval state after the approval block goes down the rejected path.   The reason is there are a few approvals one on the actual request and one if the user has requested to escalate the request. Is there a better business process?


Some Business Rule is for sure changing the field approval state after the workflow sets the value i can see it in the field history.   I am not sure if its on the approval table / cant narrow down what is changing the field. I tried to turn on debugging all and cant see anything on the incident that changed the value.   So it almost has to be on the approval table?   How can i narrow down where the field is being set?


ok so its for sure this BR on the sysapprover_approval table.   But i am still not sure how to modify this business rule so it wont override my approval value.   It looks like this is just checking approvals on WF's?




// Run any workflows for our parent so they can check the approval states


//


// 3.20.2011 - modified to use generic approval for any table via the document id/source_table,


// the check for sysapproval remains to provide backwards compatibility for records already in


// play that were entered into approval using the sysapproval to store taskID.


// Going forward, all records will get a document_id and a source table, but if they are null, this


// function assumes sysapproval column in the task table.




runWorkflow_userApprove();




function runWorkflow_userApprove() {


  var id = current.sysapproval.nil() ? current.document_id : current.getValue('sysapproval');


  var table = current.source_table.nil() ? 'task' : current.source_table;


  if (id != null && table != null ) {


          var gr = new GlideRecord(table);


          if (gr.get(id)) {


          new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null);


          }


  }


}