Workflow and Process Builder in Salesforce

Salesforce offers many automation tools like Approval processes, Workflows, Process Builder, and Cloud Flow Designer to automate the business processes. For setting up business rules most consultants make use of Workflow and Process builder.

Process Builder automates more things than workflow. Process Builder provides additional actions when compared to the workflow actions; it is like the next generation of workflow rules.

What are Salesforce Workflow Rules?

Workflow is used to automate certain business processes based on particular evaluation criteria and also have related actions.

Creating Workflow Rule: For the creation of workflow rule, we need two things- Workflow is used to automate certain business processes based on particular evaluation criteria and also have related actions.

  • 1)Criteria
  • 2)Action

1.Criteria – This is the if part of the process it must be true to execute the action relates to the expression. There are three types of evaluation criteria in the workflow.

  • Created: It works whenever the record is created it will ignore updates for the existing records. In this criteria workflow rules never run more than one time.
  • Created and every time it’s edited: It works whenever the record is created and edited. It will execute when the evaluation criteria are met. In this criterion, workflow rule runs repeatedly every time the record is edited since meeting the rule criteria.

Note: If we select this option we can't add time-based action to the rule.

  • Created and every time it's edited on subsequently meet criteria: It works every time when the record is created and edited.
  • For a new record, run the rule if the evaluation criteria are met.
  • For an updated record, run the rule only if the existing record is changed from non-meeting criteria to meeting criteria.
table2

For example- let us have a lead record that meets criteria the lead score must be greater than 50. the workflow rule will run if you create a lead with lead score 60. The rule will not run if you change/edit the lead score to 35. The rule will cause you to run if you change the lead score from 35 to 50. This last one is non-meeting to meeting criteria for which the rule will run.

2.Actions – This is then part of the process. Some actions take place when conditions are met. There are two types of actions in a workflow Rule:

  • Immediate Actions: Actions get executed just after when the record is created or edited.
  • Time-dependent Actions: these are the actions that get executed after a certain amount of time for example - Salesforce can send an email to the account team after 10 days of opportunity get closed. The workflow rules will also re-evaluate the record just to make sure that the evaluation criteria are met or not.

Actions in Workflow: It has four actions associated with it.

1. Create Task
In this, we can create a task when any record is inserted.

2. Update Field
In this, we can update the value of any field on an object record.

3. Email Alert
In this, we can send an email to one or more recipients when the action got executed after meeting the criteria. To send an email alert we need to write a proper email template from the Salesforce email template.

4. Outbound Message
In this action, you can send a SOAP message with the field value to an external server.

Example of the workflow to send an email on Account object:


Workflow_And_Process_Builder_In_Salesforce_image1

What is Salesforce Process Builder?

Process Builder is a tool which allows you to automate certain business processes with the use of a convenient graphical representation.

2) The action consists of:

  • 1. Immediate action to execute when those criteria are met
  • 2. Scheduled action(record change processes support scheduled actions).

Actions In Process Builder: It has eight actions associated with it:

1. Creating records: In this, we can create a new record and put a new value in it.

2. Updating records: In this, we can update any related records. Related records update only worked in Process Builder. This was not available in Workflows.

3. Posting on Chatter: It allows you to post on Chatter for sharing any kind of information to any user.

4. Quick action: We can make use of Quick Action to use them in any record If you already have global actions or objects, in Salesforce.

5. Launching/triggering the flow: With this, we can launch any flow from your process to automatically execute different processes.

6. Submitting the record automatically for approval: Submit a Salesforce Approval process for approval/rejection if an approval process is defined for the current entity.

7. Calling/triggering Apex code: You can also call Apex code/Trigger that you have already written within Salesforce through the process builder process.

8. Invoking another process: This action will invoke a process to another process.

Process Builder has versions so that we can hang on to deactivated Processes. This is very very helpful if we analyze something is not working fine then we can check back what was happening before.

Workflow Rule in Salesforce vs Process Builder in Salesforce:

workflow_table

Example of a process created with a process builder for updating records in case address changes:



Workflow_And_Process_Builder_In_Salesforce_image2

In Salesforce, there are three types of processes for our automation needs in the process builder. The type identifies what will trigger the process.

  • A record change process begins when a record is created or updated.
  • An event process starts when an event message is received.
  • An invocable procedure begins when something different, similar to another process, summons it.

Benefits of Process Builder:

Process Builder can be used to automate our business processes without even writing a single line of code.

  • All the Apex code and basic tasks that we are creating can be accessed and replaced by the Builder.
  • Multiple actions can be connected with every rule.
  • Both the Chatter group and email alerts can be written using Process Builder.
  • In this we can mix multiple workflows into one process.
  • Related records can be refreshed in Process Builder.
  • Applications can be developed quicker with Process Builder.

Best Practices while using Process Builder

1. Reusable actions can be created: It is recommended that you create the common actions/processes/activities like email send action, update record action, etc. Actions formed in a calling process can be reusable by invoking this sub-process at whatever point certain conditions are fulfilled in the main procedure.

2. Try to create a lesser number of actions in the process: we need to create less no of actions in the process for the best practices. You should try to accommodate multiple requirements in a single action to avoid reaching org limits like the number of DML statements.

3. A single process for one object: The best practice is to create a single process for one object. Combining many processes into one will also help to avoid process failures due to actions overwriting previous changes made to a field.

4. Be careful with infinite loops: We should be careful with infinite loops while creating multiple processes.

5. Follow a unique naming convention: While making a process, be cautious with the convention and include descriptions wherever appropriate while making a process to effortlessly recognize the functionality.

Limitations of Process Builder


  • In process builder, while creating a process be careful that the processes do not go into an infinite loop.
  • If you create a process instead of an existing workflow or Apex triggers, make sure that you need to delete the existing workflow or Apex trigger.
  • All the Actions that are executing will seem in a similar order in the process builder. You can't activate the process in the event if it contains Email Alerts action in this and scheduled actions within the procedure.
  • In Process Builder we can not use File Type custom fields.
  • Posting a message on Chatter Chatter Post if the action starts with a field reference like {![Account].name}, then the Chatter Post action may fail to save the action.
  • Process builder can only contain up to 50 versions, but only a single version can be in Active status.

Why should we use Process Builder as much as possible?

According to Salesforce, we are not exploring workflows. We still make use of workflow rules and continue to do so. But now all the new functionality for the workflow use case will come through Process Builder.

Process Builder gives you a visual and graphical representation as you build, making it user-friendly and quick. It can be considered as an extension of workflow rules and also consist of more features than.

In Process Builder, you can create the entire process through a point and click method rather than by using different workflows. It can also use custom or standard objects with related actions to automate your business process.

If you want to use the new functionality, without writing a single line of code migrate your automation to Process Builder. In the closer, these are the biggest reasons to use Process Builder because it’s the future.

For any query on Workflow And Process Builder In Salesforce, contact support@astreait.com