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! ^ ^

Related Post

Setup an awesome Salesforce developer environment ... Why Sublime Text 3 ? I've been working with Force.com for about 2 years, and always using Eclipse+Force.com IDE(See here, Eclipse Force.com IDE Installation)as my development environment. I don't think it is really difficult to use, but it could be more friendly. For example: 1. It doesn't suppo...
Using URL parameters on Salesforce standard pages Salesforce has many URL parameters can be used on its standard page, with this kind of parameters, you can do some URL hacking on it, as below: Note: All of parameters must be encoded with UTF-8. Login page There are two ways to login and access into Salesforce from url. 1. https://
Write Apex Test Classes efficiently with Tesforce 1.Why Tesforce The Test Classes are required to deploy Apex to a production environment or to be packaged and placed on Force.com AppExchange, it must provide at least 75% code coverage. That will be a huge workload to SFDC Developers if the project(application) include a lot of Apex Classes,the...
Salesforce Mass Editor (Chrome Extension) – ... This's my second Chrome Extension (First one is HERE) this year, named "Salesforce Mass Editor" and it supports for doing the below things : ・Makes any Salesforce list view to be a powerful mass editor. ・Mass insert, mass clone, mass update, mass delete, ALL-IN-ONE. ・Export record data to CSV fi...