I've been searching for a solution to this for over a week now, but no luck. The short description is that we have an approval process on the Order object, with multiple steps, each step containing the info about a person who should approve.

  • So when an order is sent for approval it goes to the approver from step 1. If he approves or rejects, everything is fine.
  • However, if x number of BUSINESS days have passed, we have to escalate to the next approver in line (step 2).

My understanding is that this requires Apex, as in order to calculate the business days we have to query the Holiday object and also check if there were no weekends in between. Since it's also a time triggered event, I'm thinking that a batch running every hour or so would be what I'm looking for.

So, I've looked for the objects behind the Approval Process and found that they are the ones with name like Process%. I found my Approval Process in ProcessDefinition, I found my steps in ProcessNode, but I cannot find any object holding the people assigned to each Node/Step: enter image description here

So I have no idea on how I could check from Apex at what step the Approval Process is at some point in time, so I could create a Task/Case for the next approver. It's also weird that in ProcessNode there is no index for the steps, just the names.

Do you guys have any tips?

Thanks in advance

1 Answer 1


The objects you've found represent the Approval Configuration, but not the actual approval instance that is generated once a record is submitted for approval.

In order to access the approval instance, you can use the object ProcessInstance and it's child records on StepsAndWorkitems.

E.g. using the following query:

select id, targetobjectid, 
(SELECT actor.name,originalactorid,StepStatus FROM StepsAndWorkitems) 
from ProcessInstance 
where targetobjectid = [yourRecordId]

Documentation on ProcessInstance (with references to child objects as well): https://developer.salesforce.com/docs/atlas.en-us.234.0.object_reference.meta/object_reference/sforce_api_objects_processinstance.htm

  • The thing is, that in fact, I am looking for the Approval Configuration. I am interested in the actual records that are created once a record is submitted, BUT when that record needs to be escalated, I have to know to WHOM I have to escalate, which I cannot find in any of these tables... Sep 16, 2022 at 6:28
  • I see.. Many have tried that in the past but it seems that it's simply something that Salesforce does not expose. E.g. this question has been here for years now: salesforce.stackexchange.com/questions/178661/… Once an approval is triggered, you could fetch the ActorId and possible query the Actor's Manager from the User table in order to define where to escalate to. Sep 16, 2022 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .