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:
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