In the previous chapters, we discussed the overview of Visual Workflow. We also talked about the benefits of using Visual Workflow and a few use cases where we can use it. We also learned the way of setting up an approval process. This chapter starts with an overview of the Process Builder. We will take the discussion forward to discuss the difference between various automation tools and when to use what. Then, we will go through step-by-step instructions to create a process using Process Builder. The following topics will be covered in this chapter:
Process Builder is an alternate way of automating your business processes by writing code. It is an advanced version of the Workflow Rule. Process Builder is created on top of Visual Workflow and Flow Trigger (Deprecated). Whenever you create a process by using the Process Builder, it will automatically create a Flow and a Flow Trigger (Deprecated) to call this Flow; this happens behind the scenes and users don't need to interact with these Flows.
Workflow Rule comes with several limitations, for example, it doesn't have an action to update child records, post to Chatter, and create a child record. Process Builder is available for the Lightning Enterprise, Lightning Unlimited, and Developer editions. It is also available for the Lightning Professional edition with a few limitations, for example, you can only have five active processes in the Lightning Professional edition. There are a few advantages of Process Builder, as follows:
As a Salesforce administrator or developer, you may get various requirements from the business to streamline the internal sales or support processes. As per our experience, we can say that many of them are achievable by using out-of-the box (OOB) features, and for a few, we must use Apex or Visualforce Page. Visual Workflow gives us another way of implementing various business processes without using Apex or Visualforce Page. The following are a few examples of it, explained in further subsections.
A business scenario: David Guzman is working as a system administrator at Universal Containers. He has received a requirement to auto-add new users to a Chatter group, Universal Containers Notice Board.
There are several ways to solve the preceding business requirement; a few of them are mentioned in the subsequent subsections.
As the requirement is to add new users to a Chatter group, we can't use Workflow Rule to achieve it. One possible solution is to write an Apex trigger on a user object to add new users to the Chatter group, Universal Containers Notice Board, as soon as the user gets created.
The following is the sample code:
trigger AutoAddNewUsertoChatter Group on User (after insert) { List<CollaborationGroup> chatterGroups=[select id, Name from CollaborationGroup where name =' Universal Containers Notice Board]; for(user user: Trigger.new) { //your logic } }
Another way to achieve the same business requirement is to create a process by using the Process Builder. Check out the following screenshot:
Here is the description for the preceding screenshot:
Process Builder is another way to automate business processes using click not code. To deploy a process in production org, you don't need to write a test class for it.
The Process Builder is a point-and-click wizard that allows you to completely automate a business requirement by creating a process. It has almost all the features offered by Workflow Rule, including a few extra features such as post to Chatter, call a Flow, create a record, and more. The Process Builder user interface has different functional parts, as follows:
Process Builder can perform almost all actions that are available for Workflow Rule and it also contains a few extra actions, but it doesn't support outbound messages. With Process Builder, you can perform the following actions:
3.17.175.21