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
Pranav_VaidyaPranav_Vaidya 

Use apex when record is submitted for approval

Hi,

 

I have 2 approval processes for a record, the flow generally is like this...

 

Step 1 - Entry criteria Status = 'Planned'

Record status changed to 'Planned'

Submit to Manger A

 

Step 2

Manager A approves,

Record status changed to 'Approver (Mgr)'

Record unlocked and re-assigned to owner

Record owner (original requestor) updates additional fields, changes status to 'Request Regioal Mgr Approval' and  submits to Manager B

 

Step 3 - Entry criteria Status = 'Request Regioal Mgr Approval'

Manager B approves

Record status changed to 'Approved (Reg. Mgr)'

Record is locked

 

I was able to achieve this with 2 different workflow processes on the same object. However I could not re-submit the record after step 2 cause I got an error that the current record does not meet an entry criteria for approval process.

 

Can I write some Apex code, trigger to achieve this?

 

Thanks.

Starz26Starz26

Look carefully at your criteria for Step 3. Something that you have set as a criteria is not being met. Without more details it is hard to say what.

 

I believe that you will have to do this in 2 seperate approval processes for the same object as the criteria for step 2 is different than step 3. The only way I see to do it is to have another process on the object where the records falls through the other steps and the last step catches it.