By Rahul Agrawal
Salesforce’s Spring 15 release launched a new feature called Lightning Process Builder. Process Builder provides an array of actions that are executed whenever a predefined criteria is matched. Below is a list of actions provided by Process Builder:
- Create record (now available for other objects, rather than only for tasks)
- Update record (allows multiple fields to be updated in one action)
- Initiate flow execution
- Quick actions (invokes object-related or global action)
- Email alert
- Post to Chatter
- Call Apex (a new feature which enables you to do many things with power of Apex)
- Submit for approval (initiates an approval process… which we’ll be talking more about in the next section)
Approvals through Process Builder
In the following example, we are exploring the submitted approval of a record using Process Builder — all without writing any code!
In this example, we have a requirement that says “no user is allowed to delete the account record except for a system administrator.” Other users can send a request to delete any account record to the system administrator, and then the system administrator will approve or deny their request. Once the user requests to have an account record deleted, the record then becomes locked, so no changes can be made until the system administrator approves or denies the request.
To meet this requirement, I need to execute an approval process for once a user clicks on the “Request delete” button. Typically, I need to write code to initiate the approval process. But here the customer wants minimum customization and Apex code. This is where Process Builder comes in especially handy.
This requirement is implemented in multiple steps. Here are the approval process steps:
- Create a checkbox field named “Request_Delete__c” on the account object.
- Create a custom detail page button and update “Request_Delete__c” with the true value.
- Create an approval process (sample approval process name: “DeleteAccountApproval”).
- Create the Process Builder request.
- Go to Setup ⇒ Build ⇒ Create ⇒ Workflow & Approvals ⇒ Process Builder
- Click on “New” or an existing Process Builder name to open.
- Set object:
- Click on “Add Object” and select the object you want Process Builder to create. Here, we are selecting “Account” as the object name.
- Add entry filter criteria:
- With “Add Action,” we will make the approval process fire when entry criteria is met.
- Click on “Save” and activate Process Builder.
I used Process Builder in this scenario because it is easy to use and maintain. Additionally, it doesn’t require Apex code in order to initiate the approval process, which saves a considerable amount of time and energy. And with Process Builder, logic changes are easily configurable and the pictorial form of data flow is easy to understand — both things that make the entire approval process simpler and more efficient than before.