1

Can anyone tell me how to write the trigger based on the approved records?
My use case is
I want to enter the records to queue if the record is approved by appropriate user.
I need an idea for this use case

Updated
Get the (custom object) record details in visualforce page and submit for the manager approval.
once he approved then the record should be submitted to the queue.
My question s how to write the trigger based on the approvals(Approved,reject and pending)
In which obj approvals are stored..

Thanks in advance
​Karthick

0

1 Answer 1

7

Approvals are handled in ProcessInstance object. For each and every update of your record in the approval process will have an entry (record) in this object. But you cannot write a trigger on this ProcessInstance object.

Instead please follow the below steps.

1) Create a picklist field - 'Approval Status' (Approval_Status__c) in your object with the values Pending,Approved and Rejected.

2) Configure your approval process: In the initial submission action, create a field update on the Approval_Status__c field to set the picklist value as Pending.

3) In the final Approval action section, create a field update on Approval Status field to set the value to Approved.

4) In the final Rejection action section, create a field update on Approval Status field to set the value to Rejected.

5) Now write the Before Update trigger on your object and check the value of Approval_Status__c. Based on the condition of the Approval_Status__c field , write your logic in the trigger to assign the record to the Queue.

You must log in to answer this question.

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