Tuesday, 8 December 2015

Automate the Approval Process

We can use process builder  and trigger to automate the Approval Process in salesforce.

Now we are going to see, how process builder is used for automation.

First we need to create the Approval Process in Salesforce.

Approval Process:


Choose the Object, you want to create the Approval Process.

For creating the Process Builder, I have used "Jump Start Wizard"  in Approval Process.

 

Then the below page will get displayed.

Here I have given the

Name for the Approval Process.
Given the criteria as Type = "Customer-Direct , Customer-Channel"
Approver as Manager.

 
Click Save. The below page will appear.



Click on "View Approval Process Detail Page". The below page will get displayed.



I have a custom field called "Approval Status field". It contains the "Submitted,Approved,Rejected,Recalled" values.

In the Initial Submission Actions Section,  click on Add New -> Field Update. The below page will get displayed.

I have given the

1. Name
2. choose the Approval Status Field.
3. Choose the "Submitted" value in the "A specific Value" Field.

Click on save.

Do the similar steps for "Final Approval Action" and "Final Rejection Action".

For Approval Action give "Approved".
For Final Rejection Action give "Rejected".

Then Activate the Approval Process. It looks like below.


Process Builder


From setup Click on "Process Builder" under "Create". click New Button. below screen will appear. Give the Name and Description. Click Save.

 
The below screen will appear.

Click on "Add Object". Choose the "Account" object and you can choose either "only when record is created" or "when a record is created or edited". Here I have choose "Only when record is created".
 Now we to give criteria, Inorder to execute the Process Builder. Here I have given "No Criteria - Just execute".


Now we have to define the Action. Click on "Add Action" link in the Process builder and choose action type "Submit for Approval". Give the Action Name, Choose the Approval Process that you have created. choose the submitter as "Current User" and click Save.

If you want to schedule, you can schedule the Actions. this is similar to Time trigger workflow.

Now Activate the Process Builder.

Note: Once process Builder is activated. we cant edit the Process Builder. In order to edit, we have to clone the Process builder.


So when ever Account record is created, it will automatically submit the record for Approval. No need of custom code to automate this.