As a best practice in Salesforce, it is always suggested that we should prefer “point and clicks” over code. ultimately, prefer Workflow rule or Process builder over Triggers. Process Builder is an automated process in Salesforce and have different actions. We can go with any of them according to our requirement to achieve the job.
An Introduction to Process Builder:
The Process Builder is an automated business process. Using this we can achieve our task in few minutes. It provides a user-friendly graphical representation of your process as you build it.
Process Builder can:
- Create processes using a convenient layout with point-and-click efficiency.
- Design an entire process in one place rather than using multiple workflow rules.
- Collaborate with different teams in your organization to create processes.
- Stop using Apex code or trigger to automate simple tasks.
Need of Process builder:
Process Builder helps to automate repetitive time-consuming tasks to without writing a single line of code in most cases.
- It allows creating new processes through using a point and click interface.
- We can build the complete business process in one place rather than using multiple workflow rules to accomplish the same.
You can use the Process Builder to perform more actions than with workflow:
- Create a record→ Not only task, create record of any Object.
- Update any related record→ Not just the record or its parent
- Use a quick action to create a record, update a record, or log a call
- Invoke a process from another process
- Launch a flow
- Send an email
- Post to Chatter
- Submit for approval
Where to use Process Builder?
Let’s say We have to sends an email to every employee of our company when a new position is created. If we do it manually then it takes a lot of time. Here we can use automated process that can do it within a few minutes. we can create a process in the Process Builder for achieving the above job, we start by choosing an object, for example, we choose an object Position.
Then we have to tell the Process Builder what to evaluate when someone creates or changes a Position record.
For example, it has to check whether a Position has a status of Open – Approved. When it does, our process executes an action, like sending a company-wide email so everyone knows that a new position has opened in the company. We can define multiple criteria nodes in a single process and associate groups of actions with each criteria node.
We can also set the criteria based on standard fields, such as Record Owner or Created Date, as well as fields based on the currently active user when the criteria is evaluated, such as their Role or Time Zone.
Why use Process builder?
User friendly interface: -
Instead of defining multiple workflow rules that manage the complexity of a specific business logic, we can design a single flow containing all the different cases. We can simply create criteria to trigger specific actions and then define additional criteria in case the first one is not executed. We can add multiple conditions in process builder.
Versions in Process builder:-
We should clone a Process builder for editing the already created process that time a new version is created for that process builder. Versions are doubtless one of the most useful features. It allows the developer to recover a previous version in case of errors, instead of using an external manage system. By activating a version, the old active one is automatically deactivated.
No need of test class:-
As Process builder “points and clicks” automated process. So, you don’t have to write test classes for process builder. It will reduce the deploying-time.