function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Identify current step of Approval process in trigger

I am trying to piggy-back some functionality onto an Approval Process step. For example if the Related User for step 2 (ProcessInstanceWorkitem.ActorId?) is set to a certain user then i want to perform an additional function in the background. But only when that step is active. I can use the ProcessInstance table to find the ProcessInstanceId which i can then use to find the WorkItem whose ActorId field shows me the related user but I don't know what step in the approval process I am in. Is it step 2 or any other step?


How can I find what step of the approval process a record is in?


Is this a lost cause? 

john hejohn he

I face the similar issue.  does anyone know how to identify the current approval process step in the apex code (or trigger)?