A process builder in Salesforce is a powerful tool to automate business processes and internal procedures. This tool is of great use as a developer can create the Process builder just by point and click. It shows the details as a graphical representation, which is tremendous to understand the flow of the logic. You can say a process builder does everything that a workflow do and it also provides impressive other features.

Let us look at all the aspects of a process builder in Salesforce in detail.

What is a Process builder in Salesforce?

Process Builder in Salesforce provides a user-friendly interface to create compelling automated business logic without writing any code. Process Builder is the next level of workflow rules as It can perform the workflow actions and extends their features.

Why is Process Builder used?

  •  A process builder can control the evaluation criteria of different processes in it. We can create the evaluation criteria and actions in the order we want.
  • Salesforce has confirmed that they are not going to enhance the features of workflow anymore. Instead, they will work on Process Builder. The support for the already implemented workflow will still be there.
  • Process Builder in Salesforce has 8 actions:
  1. Create a record
  2. Update related records
  3. Post to Chatter
  4. Launch a flow
  5.  Launch a quick Action
  6.   Submit for Approval
  7. Call an Apex code
  8. Email Alert

The best part is you do not need to know Apex coding for any of the above automation because the Process builder is there for you.

Actions

Let us see all the actions used by Process Builders mentioned above in detail

  • Create a record: You can create new records for any object and also set specific field values for the new record.
  • Updated Related records: Update one or more related records of the record that initiated the process.
  • Post to Chatter: You can post information on chatter using this action to any user or chatter group feed in Salesforce. The writer of the Chatter post will be the person who has triggered the process.
  • Launch A Flow: You can launch a visual flow from the process to execute complex business logic. But first, you will need to create a flow and activate it.
  • Launch a Quick Action: For this, there must be global action within your org to log a call, send emails, update a record.
  • Submit for Approval: You can submit the record for approval. Only the record which initiated the process can be sent for approval and not any related records.
  • Call an Apex code: You can invoke any apex class from the Process builder. You will also need to use the @invocableMethod keyword in the apex class to make it available in the process builder.
example: public class ConvertLeads{ 
@InvocableMethod public static void TestMethod(Integer LeadIds){ 
//code
        }
 } 
  • Email Alert: You will need to create an email alert outside the process builder and then invoke that email alert in the process builder. You can add email alerts for only that object, which is the starting object of the process builder.

Difference between process builder and workflow rules

Let us compare and understand what are the difference between Process Builder and workflow rules.

  Process builder Workflow rules
Control of Execution You can control the execution of the criteria by selecting the conditions before or after You cannot control which workflow it executes first then the other.
No. of Actions Process builder supports 8 actions (as mentioned in the above section) Workflow Support 4 actions. Field update, Email alert, outbound Message, Create Task
Outbound Message Support No, Process builder does not support outbound messages Yes
Invoke method When record changes(Created/Edited)Event Message is receivedInvoked by other Process  When record changes(Created/
Edited)
Complexity Multiple If/then statements Single If/then statement
Update fields Can update any related records Can edit the record or its parent

Create Process Builder in Salesforce

  • Go to Setup and Search Process builder in the Quick Find or search process builder directly in the Search Setup.
Create Process builder

Click on the new button and enter the Process Name. API name, if left blank, will take process name separated by Underscore as default. Scroll down and select when the process invokes.

  • You can select the three options given to create a process.
  1. When A record changes(Created/Edited)
  2. Platform event message is received 
  3. Invoked by other Process
select start when
  • After than an interface will open which looks like a flowchart, here you will need to add the object on which the process will work, Different criteria and actions.
Default interface
  • Defining the criteria is similar to what we do in workflow rules.
create criteria in Process Builder
  • Now select the actions based on your business requirement. Let us assume we have a requirement to create a task when Account record with type as Prospect is created. Also, post chatter after 2 hours of account creation.
select action
  • You can schedule an action in the process builder. Click on the Add action under Scheduled actions. Process builder will look after completion as shown below:
process builder

How to create a record

Using Process Builder, you can create new records and set values for the fields for the object which has started the process. 

1. Select the object and criteria and then select create a record in the action.

select and define actions

2. Give a name to the action and select the related object in which you want to create a new record.

set field values

3. Enter values to all the fields you want to populate, Mandatory fields will appear by default, and you can select additional fields. You can enter field values using three methods.

set field value types
  • String: Enter a text which will be the same for all the records created by the Process builder. Enter String values manually.
  • Field Reference: Refer to any field value of the record being created.
  • Formula: Use formula expression to enter the field value.

4. Once done, you can click on activate.

Activate process Builder

 How to edit Process

Once the process is Active, you cannot make any changes to it. You cannot modify the Name, Object, Criteria, or Actions of the Process. Suppose you missed something in the process builder or want to add a new action, criteria node you can follow these steps.

  • Deactivate the process 
Deactivate Process Builder

  • Clone the Process: You can select the cloned process as a version of the current process or a new process. It is better to set it as a version as you can easily switch back to the previous versions.
  • Now you can make any changes to the process.
  • Once done, click on Activate, and now the latest version is active. All the other versions are inactive. 
Versions

Process Builder Salesforce limitations

Limits of Process Builder:

The API name of the process must be unique in the organization.

  Description Per-Organization Limit
Active Processes Per Object   50 per Object
Total Active Processes 500
Total Processes 1000
Total Number of Criteria Nodes and actions
that is executed at run time
2000
Total Number of a group of scheduled 
actions that are executed per hour
1000
Number of scheduled actions awaiting to be
 processed
30000
Total Number of schedules
 based on a field value in processes  
20000
Governor Limits for Processes
Description Per-Organization Limit
Total Number of SOQL Queries issued 100
Total Number of records retrieved by 
SOQL Queries
50000
Total Number of DML Statements Issued 150
Total Number of records processed by DML Statements 10,000

Key Points to note:

  1. Each “Create a Record” action makes use of a single DML statement.
  2. Each “Quick Action” action uses a single DML statement.
  3. Each “Update Records” action uses one single SOQL Query and only one DML Statement.
  4. Each “Flows” action can use multiple SOQL Queries and DML Statements depending on the elements that the flow executes.

 Design consideration of Process Builder

Design Considerations of Process Builder are:

  1. Be careful while creating the processes is not going into the infinite loop.
  2. Process Name length must be within 255 characters.
  3. Process’s API Name length must be within 77 characters.
  4. A Process can have a maximum of 200 Criteria Nodes and can be associated with a single object.
  5. Actions get executed in the order in which they appear in the process builder
  6. Cannot Activate the Process if any Process contains “Email Alerts” Action and Scheduled actions within the process.
  7. Process Builder doesn’t support the field:“File Type”.
  8. A Process can have a maximum of 50 versions but only one version can be in “Active”.

Salesforce Process Builder best Practices

Before you create a Process Builder, understand the best practices you should follow:

  1. Build and test in a test environment before deploying to PROD.
  2. Do not use multiple automation tools on the same object, if an object has one trigger, 2 Process Builders and three workflows, you cannot predict the result of record change.
  3. Avoid using multiple actions, if you can combine them together.
  4. Build reusable actions in case of email alerts, Flows, Quick Actions and Apex
  5. Scheduled actions are canceled when the associated criteria are no longer valid. Make sure that the immediate action created after the Scheduled actions do not change the criteria values unintentionally.

Deploy Process Builder

You can deploy Process Builder using change sets or other migration tools. Here is a step by step instruction to deploy Process Builder using Change sets.

Categories: Salesforce Blog

0 Comments

Did you Like the content? Let me know