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:


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


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


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

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 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...
Display Address type field on Visualforce Page Address is an especial type of fields in Salesforce, which is a structured compound data type, that we can't use it directly on Visualforce page. And there will occure a compile error like "Unsupported type: common.api.soap.wsdl.Address used in expression: record.BillingAddress", if we did that. ...
Using Custom Metadata Types and Custom Settings in... Custom Metadata is one of the new features that released at Summer'15 of Salesforce, which is customizable, deployable, packageable, and upgradeable application metadata, and it supports the following custom field types.   • Checkbox   • Date   • Date and Time  ...
Writing a Schedulable Batch Apex in Salesforce To use batch Apex, you have to create an Apex class that implements interface Database.Batchable in Salesforce, like the following sample code: Execute batch Then you can use Database.executebatch method to execute it. https://gist.g...