salesforce data migration services
10
Mar

Choosing Process Builder in Salesforce

Posted by Shivam Kumar

minutes read

Process Builder is a powerful, automated tool from Salesforce that helps you automate your process by updating or creating a record. It gives you a visual representation as you build, making it user-friendly and quick. It can be considered as an extension of workflow rules – with more features. 

Through Process Builder, you can create the entire process through a point and click interface rather than by using different workflows. It uses custom objects or standard objects with related actions to automate your business process.

Actions associated with Process Builder

There are eight actions associated with the Process Builder that you can control.

  1. Creating records: You can create a new record and different field values for a record in the way you want.
  2. Updating records: You can update one or more records that are related in any way to the record that started the process. This can be done either by manually entering records or by using the records from a related record.
  3. Posting on Chatter: You can post on Chatter (internal collaboration tool) for sharing any information to any user internally.
  4. Quick action: If you already have global actions or objects, you can use Quick Action to use them in any other record you need to showcase.
  5. Launch/trigger the flow: You can launch the flow from your process to automate different processes.
  6. Submitting the record automatically for approval: The record which started your process can be submitted in the format that you want. No other record can be automatically submitted as per the process.
  7. Call/trigger Apex code: You can invoke an Apex code that you have already written within Salesforce as per your requirements.
  8. Invoking another process: You can invoke a process from another process, preventing repetitive work.

Process Builder vs Apex

When faced with the choice of using Process Builder or Apex triggers, the below comparison can help you pick the tool best suited to your requirement.

Process Builder Apex triggers
You cannot handle before DML operation.It executes only after a record has been updated or created. You can handle both before and after DML operations.
You cannot handle deleting and undelete DML. You can handle all DML operations.
An error reported in Process Builder is more generic which makes it difficult to find the origin of the error. Exception handling can be made more specific.
You cannot update unrelated records. You can update unrelated records.
You have to use Process Builder in conjunction with flows to create custom record sharing. Share records with more complex criteria than sharing Rules Permits.
You cannot create email templates that pull information from multiple records and objects combined, solely by using Process Builder. You can create email templates that pull information from multiple records and objects (combined with Visualforce).

Process Builder in Salesforce supports three types of processes for automation. These determine what will trigger the process:

  • Change in a record starts whenever the record is updated or created.
  • An event process will start whenever an event announcement is received.
  • An invocable process will start whenever another process demands it.

Some Use Cases for Process Builder vs Triggers

Scenario Process Builder/Trigger Reason
Populate a Lookup Field on record update. Process Builder Though this traditionally required a Trigger, it can now be done easily with Process Builder.

Exception:Multi layer Look up logic-ie. multiple/nested maps of related data required in trigger
Post to Chatter based on record criteria Process Builder Process Builder can be used to create Chatter groups

Exception: Use triggers for complex conditional logic to determine where to post and to whom 
A custom field on a Parent object which is based on the field related to the max (roll up) among child records. Trigger Since roll-up functionality involves insert, update, delete and undelete operations.
Submit a Quote for Approval based on Opportunity Stage (Related object criteria) Process Builder Multiple processes:
1) Update quote based on opportunity stage2) Submit the quote for approval when criteria are met.

Exception: Use trigger for complex logic; Examining products line items etc. 
Create “Sales Rep” field with data type (Text) on the Account Object. When we create the Account record, the Account Owner will be automatically added to the Sales Rep field. Similarly, when we update the Account owner of the record, the Sales Rep will be automatically updated. Trigger This is very difficult to achieve with the help of Process Builder and easier with the help of triggers.

Process Builder Vs Workflow

Let’s delve into the differences between Process Builder and Workflows. If you are looking at picking a favorite, it’s difficult to identify a clear winner since the application of either will depend on the specific scenario at hand.

Actions Process Builder Workflows
Ability to see process visually Yes No
Update fields on the record Yes Yes
Update fields on a related record Yes Only Parent records
Create records Yes Task records only
Send an Email Alert Yes Yes
Send an Outbound Message No Yes
Can insert/ update an Id field Yes No
Launch a Flow Yes No
Invoke an apex class Yes No
Sumit record for approval Yes No
Post to chatter Yes No
Support time based actions Yes Yes
Control the order of process steps Yes No
Support for bulk record inserts/updates Yes (in most instances) Yes

Benefits of Process Builder:

Process Builder is used for automating your business processes without writing even a single line of code.

  • The visual analysis provided by Process Builder enables you to know in a flash what to expect in each process.
  • Applications can be developed faster with Process Builder.
  • It can blend multiple workflows into one process.
  • Multiple actions can be linked with each criterion.
  • Child records can be updated in Process Builder.
  • Both Chatter group and email alerts can be written using Process Builder.
  •  All the Apex code and simple tasks that we are creating can be accessed and replaced by the Builder.

Limitations of Process Builder

  • While creating, be careful that the processes do not go into an infinite loop.
  • If you create a process instead of an existing workflow or Apex triggers, make sure that you delete the existing workflow or Apex trigger.
  • Process Name must be within 255 characters.
  • Process’s API Name must be within 77 characters.
  • A process can have a maximum of 200 Criteria Nodes and can be associated for a single object.
  •  All the Actions which are executing will appear in the same order in the process builder. You cannot activate the process if it contains “Email Alerts” action and scheduled actions within the process.
  • Process Builder does not support the “File Type” custom fields.
  • Posting a message on  chatter “Chatter Post”  if action starts with a field reference like {![Account].name}, then the “Chatter Post” action may fail to save the action.
  • A process can have up to 50 versions, but only a single version can be in “Active” status.
Description Per Organization Limit
Active Processes Per Object 50 per object
Total Processes   1000             
Total Active Processes  500
Total Number of Criteria Nodes that are evaluated and actions
that are executed at run time 
2,000
Total Number of group of scheduled actions that are waiting to be processed    30,000
Total Number of group of scheduled actions that are executed per hour 1,000
Total Number of schedules based on a field value in processes   20,000

Best Practices while using Process Builder

  1. Reusable actions can be created: It is recommended that you create common actions/processes/activities like email send action, update record action, etc. Actions configured in an invocable process can be reused by calling this sub-process whenever certain conditions are satisfied in the main process.
  2. Try to create a lesser number of actions in the process: Best practice is to create a lesser number of actions in a process. You should try to accommodate multiple requirements in a single action in order to avoid reaching org limits like the number of DML statements.
  3. Single process for one object: It is better to create a single process for one object. Combining multiple processes into one also helps to avoid process failures due to actions overwriting previous changes made to a field. 
  4. Be careful with infinite loops: When you are creating multiple processes, you should tread carefully with infinite loops.
  5. Use case testing:There can be multiple use cases where one action can affect other processes that are part of the system. It is recommended that you do a thorough round of testing of the process and affected fields before deploying in production in order to avoid conflicts with other processes.
  6. Follow a unique naming convention: While creating a process, be careful with the naming convention and add descriptions wherever applicable while creating a process to easily identify the functionality.

Business Use-Case

Pamela Astro is working as a System administrator at Rainy Cloud. She wants to send a welcome email to a lead when the lead is in “Converted” status.

There are a few possible solutions for the above business scenario. But lets try using Process Builder to solve this without creating custom fields. Follow the below instructions to create a Process for the above business requirement.

Step 1. Click on the right side gear icon Setup | App Setup | Quick Find| Process Builder. Click on the New button, Enter Name, API Name and then click on the Save button.

Step 2. The next step is to add the entry criteria. For this click on Add Object, select Lead object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button.

Step 3. The next task is to add Process Criteria. To do this, click on Add Criteria, Criteria Name| Criteria for Executing Actions | Set Conditions, as shown in the below screenshot. Once you are done, click on the Save Button.

Step 4. The next step is to add an Immediate action to Process. Click on the Add Action (Under Immediate actions), Select and Define the action, and then fill out the fields to define the action, as shown in the following screenshot.

Step 5. Once you are done, click on the Save button. You will be redirected to Process canvas. Finally, the Process will look like the following screenshot.

Don’t forget to activate the Process by clicking on the Activate button.

References

 



Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments