Salesforce Process Builder: use cases and limitations

on

The Lightning Process Builder helps you easily automate processes by providing a powerful and user-friendly visual representation of your business logic.

It combines the features of the workflow rules, the approvals, and Apex, allowing you to:

  • Create a record
  • Update any related record—not just the record or its parent
  • Use a quick action to create/update a record and log a call
  • Launch a flow as an immediate or a scheduled action
  • Send an email
  • Post to the Chatter
  • Submit for approval

Wow! It seems I can use Process Builder to do everything in Salesforce, is it right? No, it isn’t. Process Builder is another powerful option you can consider, but it will not substitute Apex, workflow rules, and approvals at all. Obviously, you need to understand the pros and the limitations before making a choice.

Lightning Process Builder Pros

A simple and flexible User Interface

The UI is really user-friendly. It consists of the following parts:

  1. A button bar with useful actions, such as Clone and Activate the process
  2. The records evaluation criteria: when a record is created/edited
  3. One or more criteria nodes: each criterion includes the conditions to evaluate if a record should enter into the specific business logic branch
  4. One or more immediate or scheduled actions, executed when the associated criteria are satisfied

Process Builder

A simple and flexible User Interface

Instead of defining multiple workflow rules that manage the complexity of a specific business logic, you can design a single flow containing all the different cases. You can simply create criteria to trigger specific actions and then define additional criteria in case the first one is not executed.

Versioning

Versioning is probably one of the most useful features. It allows the developer to recover a previous version in case of errors, instead of using an external control system. By activating a version, the old active one is automatically deactivated.

No test class

As well as workflow rules and approvals you don’t have to write test classes. It will reduce the deploying-time but be careful, automate testing can save your life. In addition, you must pay attention to the impact of the defined process builder on other Apex Classes, in order to avoid an ugly “CANNOT_EXECUTE_FLOW_TRIGGER” or similar errors.

Use Case: Update a field (address) in Account object and do it in all related contacts

In this simple use case, we are going to update child objects when the parent object is modified. In particular, we want to update Contact records whenever the Account billing address changes. Let’s see how:

Step 1 – Create a new process

Create a new process from the process builder page (search Process Builder from Setup in Lightning or Classic), and insert the following info:

  1. Process Name: Contact address change
  2. The process starts when: A record changes

Step 2 – Set the main object

In the “Add Object” box, select Account and flag the option “when a record is created or edited”

Step 3 – Add criteria

Add the process criteria in the “Add Criteria” part, specifying the following information:

  1. Criteria Name: Address Change
  2. Criteria for Executing Actions: Conditions are met
  3. Set the “Billing Street” as field, “is changed” as Operator and “True” as value in the Filter Conditions
  4. Conditions: All of the conditions are met (AND)

Step 4 – Add actions

Under the Immediate Actions box click “Add Action” and insert the following information:

  1. Action Type: Update Records
  2. Action Name: Update Contact Addresses
  3. In the Record Type part choose “Select a record related to the Account” and then select “Contacts” as related records
  4. Criteria for Updating Records: No criteria—just update the records!
  5. In the Set new field values for the records you update part choose “Mailing Street” as field, “Reference” as Type and “Billing Street” as Value

Step 5 – Activate it!

Activate the process and test it. Does it work? Cool, you defined your first Process Builder!

Process Builder Limitations

Limitation 1: Outbound Message

It’s not possible to send outbound messages, as you do with Workflow Rules. This limitation can be overtaken by defining an apex class and recall it by setting Action Type “Apex”.

Limitation 2: Apex Trigger vs Process Builder

Each process can be associated with a single object only. Therefore, if you need to update multiple objects when an event occurs, Apex can be the solution.

Considerations

As I said at the beginning, Process Builder is a powerful tool to visually design business logic, but it can’t substitute Apex, Workflow Rule, and approvals so far. Anyway, Salesforce is investing a lot in this feature, so we will probably receive interesting surprises in the next future! Stay tuned!

Reference

  1. Automate Basic Business Processes with Process Builder Unit
  2. Salesforce Developers
  3. Trailhead
(Visited 1,607 times, 1 visits today)

3 thoughts on “Salesforce Process Builder: use cases and limitations

Leave a Reply

Your email address will not be published. Required fields are marked *