Bulk Approval Processing from List View in Salesforce

I have shared “Approval Processing with Apex in Salesforce” in previous post, and in this post, I’ll continue to share the way of bulk approval processing from Salesforce list view.

The outline we need to do is as below :
・Add a custom button for list view
・Set List View Layout
・Add a Apex Class named “BulkApprovalWebService”

Let’s get started:

Add two custom buttons for list view

Add two custom buttons, “Bulk Request” and “Bulk Approve” as below:

Bulk Request button

Bulk Request Button with the following javascript code:

Bulk Approve button

Bulk Approve Button with the following javascript code:

Set Contract List View Layout

Add custom buttons to List View Layout as the below image: Contract List View Layout

Apex Class

Add an Apex Class with the following source code :

Operation Check

First, submit approval request as “Member B” user by clicking “Bulk Request” button.
Bulk Approval Request Then approve those request as his manager user by clicking “Bulk Approve” button.
Bulk Approve Two records were approved successfully.
Bulk Approved
Enjoy It!

Related Post

To fix “portal account owner must have a rol... In Salesforce, if you're trying to run Unit Test with a Non-Role user, which includes part of creating Portal / Community User test data, the following error will be occured, that is because the portal account's owner does not have a role to be assigned. System.DmlException: Insert failed. First e...
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: https://gist.github.com/919ab1cbae98a114c2a8e46197bd2f63 Execute batch Then you can use Database.executebatch method to execute it. https://gist.g...
How to access static resources from Apex, Visualfo... In Apex Normal file (with soql) https://gist.github.com/eac33b70c28f56b5cf62 Normal file (with PageReference.getContent) https://gist.github.com/68ad16f743294cafb3d8 Zip file (with PageReference.getContent) ※Zip file can not be accessed by soql. https://gist.github.com/98f5923672821e224ff...
Order of execution in Visualforce Page In this post I'll show you the order of execution when we views a Visualforce page. Apex Class https://gist.github.com/76d563561d3eaea7b422 Visualforce Page https://gist.github.com/bd9932913efe98a9a678 Result Log https://gist.github.com/b8a7a806ed6c31cf2a39 So,In conclusion: 1.Cont...