The Lightning Process Builder is a modern way to develop state machines within a graphical representation. This is because a picture is worth a thousand words.
This modern tool is basically an If This Then That (ITTT) tool and like workflow rules and other automation processes (such as approvals or entitlements), it holds a conditional statement (IF), along with the corresponding actions to perform (THEN).
Do you remember what workflow rules can do? They can do the following:
- Update one of the fields of a source object or of a parent record (with a master-child relationship)
- Create a task
- Send an email
- Send an outbound action
What can a Process Builder do instead?
- Create a record (not only tasks)
- Update related records or the source record itself
- Launch a quick action
- Post to Chatter (A Salesforce collaborative tool. For more information about Chatter, please refer to Salesforce Help at https://help.salesforce.com/articleView?id=collab_overview.htm&type=5).
- Launch a flow
- Submit a record for approval
- Invoke another Process Builder
- Launch an automated flow
- Send an email
- Send a custom notification
- Call Apex code
Besides the differences in the number of available actions, the Process Builder also allows us to apply actions in a specific order. This is something that is lacking in workflows. In workflows, we don't have a way to predict which action was performed first. Moreover, the Process Builder works with platform events, while workflow rules don't.
The ability to aggregate conditions and actions on the same instance of the Process Builder, along with having a clear graphical representation of the state machine, provides administrators with a powerful tool they can use to automate their processes.
Also, it's not good to mix workflow rules and Process Builders: evaluate a migration to Process Builder from older workflow rules, as pictured in the Trailhead module referenced in the previous information box. That way, you'll have a more consistent automated process implementation and a better way to predict the automation behavior of any record.
The ability to have different versions of a given Process Builder also gives you the power to try new versions of an automation process, along with the chance to roll back if things go wrong.
While dealing with Process Builders, you'll find the same concepts as the ones that are found in workflow rules, but with some enhancements and cool features.
Now that we know what a Process Builder is, let's look at how we can build one.