We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Nested approvals - the record is approved by the first approval before the second one is triggered

Tony V
Kilo Sage

My customer has an approval requirement for the Request (sc_request) level of a submitted order guide. There are 4 scenarios:

  1. Approval 1 and Approval 2
  2. Approval 1 only
  3. Approval 2 only
  4. No approval

Scenario 2-4 work as expected.

 

Approval 1 is a single user which is pulled from a submitted variable (it performs a lookup of an RITM to get the variable value)

 

Approval 2 is driven by a table where there can be multiple approval groups listed. So when the flow gets to Approval 2 it performs a lookup of that table with appropriate criteria and then performs a For Each under which it generates one approval at a time until all the approval records are accounted for.

 

The issues is that in Scenario 1 when Approval 1 is approved, it marks the Request approved. That triggers the flows in the RITMs to start. THEN Approval 2 is triggered and the Request Approval State is set back to 'Requested'. But of course the RITM flows have already started, so it is possible that the RITMs will start to get fulfilled even though they are not truly approved.

 

At this point of the flow I am not using a stage or update record action to update the Requst.

 

Here is the portion of the flow in question

TonyV_0-1771002940457.png

 

And in the execution details you can see that step 5 Ask for Approval is returning an Approved State of 'approved'. So how does one design a flow with nested approvals without the first approval approving the record prematurely?

 

TonyV_1-1771003098845.png

 

 

3 REPLIES 3

Vaibhav Chouhan
Tera Guru

The issue is that Approval 1 is updating the Request’s approval field. As soon as that first Ask for Approval action completes and writes to the approval field, the Request moves to Approved, which triggers the RITM flows to start. After that, Approval 2 runs and sets the approval state again, but by then the RITMs have already started processing.

The fix is simply to control which Ask for Approval step updates the approval field. In the first Ask for Approval, leave the “Approval Field” empty. The approval will still be sent and processed, but it won’t update the Request’s approval field. Then in the second Ask for Approval, set the “Approval Field” to the Request’s approval field. When that one completes, the Request will be marked Approved.

This way, the Request only becomes approved after the final approval is completed, and the RITM flows won’t start prematurely.

VaibhavChouhan_0-1771052889608.png

 

We have already removed the Approval field for the first approval and tested it. However, once the first approval is completed, the Request state automatically changes to Approved, and the RITM flow starts. It is not waiting for the second approval.

sathishselv is working on this with me. His response is correct.

 

Vaibhav Chouhan if we clear the Approval field as you suggest, there is no change in behavior. The Request is momentarily approved before being reverted to Requested. But this triggers the RITM flows.