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:
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.
The UI is really user-friendly. It consists of the following parts:
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 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.
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.
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:
Create a new process from the process builder page (search Process Builder from Setup in Lightning or Classic), and insert the following info:
In the “Add Object” box, select Account and flag the option “when a record is created or edited”
Add the process criteria in the “Add Criteria” part, specifying the following information:
Under the Immediate Actions box click “Add Action” and insert the following information:
Activate the process and test it. Does it work? Cool, you defined your first Process Builder!
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”.
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.
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!