Approval Processing with Apex in Salesforce

An approval process is an automated process your organization can use to approve records in Salesforce. Usually we can request/approve an approval process through the standard approval process feature, but we can also do those things with Apex in some cases such as : request/approve from VF Page or from Custom Button.

Here is Approval Process Objects ER :
Approval Process ER And here are the samples as the following Apex Code:

Request

Approval.ProcessSubmitRequest class provides the way to submit approval request(s).

Approve/Reject

And we can approve/reject that request through Approval.ProcessWorkitemRequest class.

Unlock

Once a record has been approved, we can unlock it through Approval.ProcessWorkitemRequestApproval.unlock().

In next post, I’ll share “How to do bulk Approval Processing from list view“.
Enjoy It! ^ ^