Process Builder

Introduction

Process Builder is a combination of Flow and Workflow rules. In other words, we can say that it’s the next level of Workflow rule that allows us to automate your business process by creating Processes with point-and-click more than workflow without writing a single line of code.

Scenario

Arun is doing business with a company (which we call an Account in Salesforce), which changes its location. Arun wants a way to automatically update the business address of all the people that work at that company (your Contacts).
Webp.net-resizeimage_9

Why do we need to use Process builder?

In workflow rule only have 4 actions and process builder have 9 actions, by using workflow we cannot create a child record, Post to Chatter or Auto submit record in the Approval process so for doing this kind of action we need to use process builder.

Types of processes

Process Builder supports three types of processes for your automation needs. The type determines what triggers the process.

  • A record change process starts when a record is created or updated.
  • An event process starts when a platform event message is received.
  • An invocable process starts when something else, like another process, invokes it.

Each process consists of:

  • Criteria that determine when to execute an action group.
  • Action groups, which consist of immediate or scheduled actions. Only record change processes support scheduled actions.

Actions

  • Apex
  • Create a Record
  • Email Alerts
  • Flows
  • Post to Chatter
  • Processes
  • Quick Actions
  • Submit for Approval
  • Update Records

Process Builder vs. Workflow

  • Create a record of any object type
  • 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—you can’t schedule this action with workflow
  • Send an email
  • Send a custom notification
  • Post to Chatter
  • Submit a record for approval

Process Limits

When building processes, keep shared limits and Apex governor limits in mind. In addition, a process’s API name must be unique across all processes and flows in your org.

Process Usage-Based Entitlements

Like feature licenses, usage-based entitlements don’t limit what you can do in Salesforce; they add to your functionality. If your usage exceeds the allowance, Salesforce will contact you to discuss additions to your contract. In the meantime, your processes continue to run as usual.

When Do Processes Evaluate Record Changes?

Processes start automatically and are invisible to the user. Before you design or activate a process, understand which changes trigger processes.

Create a New Process on the Account Object

Create a process and then select the object on which the process runs. Also make sure the process kicks off whenever a record is edited, because we’re going to change the business address in a moment.

Process

  • From Setup, enter Builder in the Quick Find box, and select Process Builder.
  • Click New.
  • For Process Name, type Contact address change.
  • For The process starts when, select A record changes, and click Save.
  • Click + Add Object.
  • In the right window, select Account from the Object drop-down list.
  • For Start the process select when a record is created or edited.
  • Click Save.

Create Criteria

  • Click Add Criteria.
  • For Criteria Name, type Address Change.
  • For Criteria for Executing Actions, keep it set to Conditions are met.
  • For Set Filter Conditions, click Find a field…, select Billing Street and click Choose.
  • Set Operator to Is Changed, and set Value to True.
  • For Conditions, keep it set to All of the conditions are met (AND).
  • Click Save.

Create an Action

  • Under the Immediate Actions box, click + Add Action.
  • In the Action Type drop-down list, select Update Records.
  • For Action Name, type Update Contact Addresses.
  • For Record Type, click the radio button next to Select a record related to the Account, then scroll down and select Contacts, and click Choose.
  • Process Builder allows you to choose not just fields on Accounts, but fields that are related to Accounts.
  • For Criteria for Updating Records, keep it set at No criteria—just update the records!.
  • Under Set new field values for the records you update, click Find a field…, and then scroll down and select Mailing Street. Select Field Reference for the Type.
  • For Value, select Billing Street as the Account field and click Choose.
  • Click Save. Click Activate and then click Confirm.

Some important things to note before you move on:

  • This task adds only one action, but you could add multiple actions for one criteria.
  • Did you notice that Accounts have a field called Billing Street, but that Contacts have a field called Mailing Street? That’s OK, it’s a different field name, but you’ll use the same value.
  • Once a process is activated, it cannot be edited. If you need to make edits to an activated process, follow these steps:
    • Clone the process as a version of the current process.
    • make changes to the cloned process.
    • activate the new version.

Q & A:

Q1. What is Mixed DML Operation and how to solve Mixed DML Operation Error in Process Builder in Salesforce?

If any user wants to perform DML operation on setup and non-setup object in the same transaction then there is a chance of generating “Mixed DML Operation” error.

Example:

ABC company give a requirement to their employees, if any employee joins our company then we will create a user in user object and as well as we will auto create a sick leave, casual leave, earn leave in there leave balance object which is a custom object. If an employee will perform this scenario then an employee will get Mixed DML Operation error.

Solution:

As we know we can not use DML operation on the setup and non-setup object in the same transaction then we have to separate it by time dependent trigger.

Q2. What are the things which we can not do with process builder in Salesforce?

  1. Deleting Records (Alternative: Flows/Apex Trigger )
  2. Outbound Message (Alternative: Workflow/Apex Trigger)
  3. Cloning a record (Alternative: Apex Trigger)
  4. Updating unrelated records (Alternative: Flows/Apex Trigger)

Q3. What kind of related records can we update using process builder in Salesforce?

  • Parent Records (Master or Lookup)
  • Child Records (Master or Lookup)

Leave a Comment

Your email address will not be published. Required fields are marked *