Working With Process Builder – I

In this post, we will explore Process Builder tool by developing a process targeting specific business problem. It is more focused on understanding and implementation of Process Type, Trigger, Criteria and Actions involved as a part of the solution to this problem.

Process Builder is a point and click automation tool available with the Salesforce Platform. Salesforce documentation covers all the details and I would recommend you to through details by using the following URL before following this demo: Automate Simple Business Processes with Process Builder

In this demo, we will explore the Process Builder tool by developing a process targeting a specific business problem. It is more focused on understanding and implementation of Process Type, Trigger, Criteria and Actions involved as a part of the solution to this problem.

Problem Statement

Here is a simple but relatively effective problem statement to solve using Process Automation-

Whenever a new Account is introduced, create a follow-up task and assigned it to the Account Owner, if Annual Revenue for an Account is greater than or equal to $100K and if Account Type is equal to “Technology Partner”

Analysis of Problem Statement

In the real world as developers we would always look into the problem statement carefully to identify the best approach to solve it, so adopt it as a thumb rule.

Salesforce offers many tools & approaches to solving the same set of problems and it is our responsibility to take the best possible approach based on the problem statement.

So let’s try to break down the problem statement and map it with Process Builder Implementation.

From the problem statement we have –

  • Trigger: New Account Record added
  • Criteria: (Annual Revenue >= $100K) And (Account Type = “Technology Partner”)
  • Action: Create Task and assign to Account Owner

Once we have a clear understanding of the Problem Statement we can start developing the process automation and map this required with it.

Launch the Org and search for “Process Builder” in Setup Navigation on the left as shown below

This will launch the “View All Processes” screen where we can the list of all the process created earlier

Click on the “New” button

This will launch the “New Process” Configuration dialog box

Specify the details “Name, API Name, Description, and Process Type” for the new process, here it is worth to pay attention to the Process Type dropdown-

In this dropdown we have three options which will decide on how this process will be initiated-

  • Record Change – This allows the process to execute when any record level changes made (Insert or Update for the record)
  • Invocable – This allows the process to execute when it is invoked by any other process, this type is helpful for processes participating in Process Chaining (when one process calling another process)
  • Platform Event – This is a special implementation that allows a process to execute when a platform event occurs. Platform events are those events that are not generated based on database changes but generated by external devices associated with the platform.
  • Record Change – This allows the process to execute when any record level changes made (Insert or Update for the record)
  • Invocable – This allows the process to execute when it is invoked by any other process, this type is helpful for processes participating in Process Chaining (when one process calling another process)
  • Platform Event – This is a special implementation that allows a process to execute when a platform event occurs. Platform events are those events that are not generated based on database changes but generated by external devices associated with the platform.

Example: A printer may publish a day end notification for Salesforce say to notify about the low paper quantity in the tray. This notification may include the details about a printer (Serial Number, Port Number, Physical Location and so on). We can develop process automation that will be triggered based on this event and create a task for admin to replenish the paper in the printer tray.

Once you have specified the details click “Save” to save the changes.

As soon as the process information is saved we should be able to see the Process Builder Design Canvas where we can start the designing process.

This canvas contains the following moving parts:

  1. Action Toolbar: The action toolbar will help to manage the canvas by providing quick access to multiple features like “Edit Properties” that can be used to edit the properties of the Process.
  2. Start: Represents the start of the process
  3. Add Object: Represents the trigger for the process, allows you to choose for the trigger target object (Salesforce sObjects) & trigger event (Record Added, Record Modified or Both)
  4. Decision Box: Represents the criteria to meet for the process to execute
  5. Actions Box: Represents the list of actions to be taken if criteria met. Actions could be “Adding a Task”“Send Email Notifications”“Updating Fields” and so on.
  6. Scheduled Actions Box: Represents the action that we would like to perform at a specific interval of time (Date, Day, Hour). For example, you could perform an action based after (process trigger date + certain number of days)
  7. Stop: Represents the termination of the process
  1. Action Toolbar: The action toolbar will help to manage the canvas by providing quick access to multiple features like “Edit Properties” that can be used to edit the properties of the Process.
  2. Start: Represents the start of the process
  3. Add Object: Represents the trigger for the process, allows you to choose for the trigger target object (Salesforce sObjects) & trigger event (Record Added, Record Modified or Both)
  4. Decision Box: Represents the criteria to meet for the process to execute
  5. Actions Box: Represents the list of actions to be taken if criteria met. Actions could be “Adding a Task”“Send Email Notifications”“Updating Fields” and so on.
  6. Scheduled Actions Box: Represents the action that we would like to perform at a specific interval of time (Date, Day, Hour). For example, you could perform an action based after (process trigger date + certain number of days)
  7. Stop: Represents the termination of the process

Enough of the theory, it is time to see some action-

To add the trigger for the Process click on “Add Object”

  1. Click Add Object
  2. Select the trigger target as any desired sObject from Object Dropdown, I choose Account Object based on the problem statement
  3. Select the trigger condition as when do you like to initiate the process. I choose “only when a record is created” based on the problem statement
  4. Click “Save” to persist the changes
  1. Click Add Object
  2. Select the trigger target as any desired sObject from Object dropdown, I choose Account Object based on the problem statement
  3. Select the trigger condition as when do you like to initiate the process. I choose “only when a record is created” based on the problem statement
  4. Click “Save” to persist the changes

To add the criteria click on “Add Criteria”

  1. Click Add Criteria
  2. Enter the name of the criteria to uniquely identifies the criteria by its function
  3. Select applicable conditions to execute actions
  4. Configure condition based on your problem statement:
    • Account.Annual Revenue >= 100K
    • Account.Type  == “Technology Partner”
  • Evaluate the conditional logic to merge the conditions using logical operators. It follows the format: Condition 1 <logical operator> Condition 2

“Customize my logic” is my preferred option since it gives me maximum flexibility to place conditions more logically in whatever way best suited the requirement.

Here I have mentioned “1 And 2”, which mean both conditions 1 & 2 must be evaluated to True to success these criteria

  • Click “Save” to persist the changes

To add the actions click on “Add Actions”

  1. Click Add Action
  2. As per the business requirement, we need to add a task, so I am selecting “Create a Record” as Action Type
  1. Click Add Action
  2. As per the business requirement, we need to add a task, so I am selecting “Create a Record” as Action Type
  • Specify the name to uniquely identifies the action, lets’ call it “Follow-up Task”
  • Since we are expecting to create a task so we need to select the sObject accordingly. In our case, we will choose “Task” as Record Type
  • Select all the required fields to add the task. It is worth taking note of how we specified the Field Type.
  • Specify the name to uniquely identifies the action, lets’ call it “Follow-up Task”
  • Since we are expecting to create a task so we need to select the sObject accordingly. In our case, we will choose “Task” as Record Type
  • Select all the required fields to add the task. It is worth taking note of how we specified the Field Type.

Assigned to ID: We have set it to the reference of the Owner ID Field in Account object.

Priority & Status: We have set it to the respective Pick Lists for each of them

Subject: We can construct the field values using Formula, it is really powerful feature that allows to compute field values dynamically. Here is it important to mention that you should pay attention on how we define the formula as closely as possible as formulas are necessary elements for declarative programming tools & technologies.

Once you are done with defining the necessary formula, don’t forget to click on “Use this Formula” button to apply the formula as the basis of computed field value.

  • Click “Save” to persist the changes

We are not planning to demonstrate the Scheduled Actions in this demo, moreover, it is not required as per the problem statement. But I will cover this topic with more details and a demo in one of my future articles.

With this, we are all set to go for activation of this Process.

To activate the Process click the “Activate” button as shown in Step 7 in the top toolbar as shown below. This action will prompt a confirmation box confirming if you wish to activate this version of the Process.

Click “Confirm” to activate this Process.

It is important to note here that Salesforce can maintain multiple versions of the same Process at the same time, but only one version will remain active.

We can deactivate the active version anytime (as shown below) and can activate any other version as required.

It is a good approach from a development stand point, this give us flexibility to test a Process with different logic if required while maintaining all the versions for references as shown below. In the screen shot below we can see that this Process is having Version-3.

So since we have already Activate the latest version of the Process, it now the time to test it.

Here is the test plan to validate the working of this process:

Positive Test: I am demonstrating a positive test in this demo that will satisfy the criteria of the Process and let it creates the task as expected.

  • Launch Account Object list view
  • Click on “New” button on the toolbar to add a new Account
  • Fill the following details:
    • Account Name: Specify a suitable account name, I have specified “NewAccount01”
    • Type: Select “Technology Partner” from the dropdown list (Since it a positive test, we need to meet the criteria)
    • Annual Revenue: $200,000
  • Click “Save” to add the account
  • Once account created successfully we need to launch the “Task” Object list view
  • Look for the recently added tasks matches Subject line as per the formula we used to compute it value
  • It is worth taking note of how Subject text is computed using the formula

Negative Test: I would love to leave it for you as an exercise, and if you follow along this article it would not be difficult for you anymore.

Hope you enjoyed this article. Please leave your comments to let me know how you do like the content and how you do find it helpful to learn the topic.

Author: Prashant Bansal

Passionate Software Developer, Author, Trainer and Learner with over 13+ Years of extensive software development experience using leading CRM Systems like Salesforce & SharePoint with avid interest in learning and adapting to new technologies and Platforms. Author of over 100+ Technical Articles on Salesforce & SharePoint implementations, contributing to Tech Communities around the globe. Owner of one of the top 50 Blogs on CRM Development Platforms.

One thought on “Working With Process Builder – I”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s