Book Image

Learning Salesforce Visual Workflow and Process Builder - Second Edition

By : Rakesh Gupta
Book Image

Learning Salesforce Visual Workflow and Process Builder - Second Edition

By: Rakesh Gupta

Overview of this book

Salesforce Management System is an information system used in CRM to automate the business processes like sales and marketing. To implement this, Force.com developed a powerful tool called Visual Workflow to automate business processes by creating applications also called Flows. Learning Salesforce Visual Workflow, Second Edition is a practical guide on Flows that will enable you to develop custom applications in Salesforce with minimized code usage. The book starts with an introduction to Visual Workflows that teaches all the building blocks of creating Flows and use it efficiently. You will learn how to easily automate business processes and tackle complex business scenarios using Flows. The book explains the working of the Process Builder so you can create reusable processes. The book also covers how you can integrate existing or newly created Flows with the Salesforce Lightening Experience. By the end of the book, you will get a clear understanding on how to use Flows and Process Builder in your organization to optimize code usage.
Table of Contents (9 chapters)

An overview of the building blocks of Visual Workflow

Flow has three major building blocks known as Element, Connector, and Resource. With the help of these blocks, you can easily develop Flows.

The Element block represents an action that Flow can use to display or collect information from the Flow user, create or update records, delete records, or loop logic. The Element block is used to manipulate the data. The Connector block is used to establish the path between the elements. A Resource block is used to hold the data that you can reference in your Flow.

Flow elements

Flow elements represent actions that Flow can execute such as Record Update, Record Lookup, Fast Lookup, Loop, Screen, and Decision. This is used to read, write, or delete data. Using the element (Screen), you can also display data and capture input from users. Use the Palette tab to drag and drop new elements onto your canvas. Once you add elements, it will be available on the canvas and Explorer tabs.

There are several types of elements available under the Palette tab. They are as follows:

Flow element Description
Step You can use this as a placeholder while designing your Flow. Later, you can convert Step elements into Screen elements.
Screen This will display a screen to the user who is running the Flow. The Screen element contains input or output fields. The Screen element is mainly used to take input from users or display guided information.
Decision This is used to evaluate conditions to determine which Flow path to take.
Assignment This is used to set or change values of variables, collection variables, SObject variables, and SObject collection variables.
Loop This iterates through an SObject collection variable and assigns an item's value to an SObject variable.
Wait If you want your Flow to wait for one or more defined events to occur, then use this element.
Record Create This is used to create one record using the field values that you specify separately. You can assign these values from Flow resources such as variables, SObject variable, and the screen fields.
Record Update This is used to update records using the field values that you specify separately. You can assign these values from Flow resources such as variables, SObject Variable, and the screen fields.
Record Lookup This is used to extract one record that meets the filter criteria you specify, and then assign the record's field values to separate, individual Flow variables or individual fields on SObject variables.
Record Delete This is used to delete records from Salesforce that meet the filter criteria you specify in your Flow.
Fast Create This is used to create records using the fields' value from an SObject collection variable or to create one record using the field's value from an SObject variable.
Fast Update This is used to update records using the field's value from an SObject collection variable or to update one record using the field's value from an SObject variable.
Fast Lookup This is used to extract records to assign their field values to an SObject collection variable or query one record to assign its field values to an SObject variable.
Fast Delete This is used to delete records using the ID value from an SObject collection variable or to delete one record by using the ID value from an SObject variable.
Apex Plug-in This is used to call an Apex class that implements the Process.Plugin interface. If you used the tag property in the PluginDescribeResult class, the Apex class appears under a customized section. Otherwise, it appears under the APEX PLUG-INS section.
Subflow This is used to invoke another Flow in the organization.
Quick action This calls an object-specific or global action, such as NewTask and LogACall.
E-mail Alerts This is used to send an e-mail using a Workflow e-mail alert to specify e-mail template and recipients.
Post to Chatter Using this element, you can post a message to the feed for a specific record, user, or Chatter group.
Send Email This is used to send an e-mail using Flow with the specific subject, body, and recipients.
Submit for Approval This is used to auto submit one record for approval.

From Chapter 2, Creating Flow through Point and Click, we will start using these elements.

Flow resources

Resources are used to hold the data that you can refer in your Flow. The Explorer tab displays the resources that you added to the Flow. To create new resources, double-click on this tab. Global constants and system variables are automatically provided by the system. There are several types of resources available under the Resource tab. They are as follows:

Flow resource Description
Variable This is used to store a value that can be updated as the Flow is executed. It can be referenced throughout the Flow and can be used as the value of a field in a record.
Global variable These are system-provided variables that can be referenced as resources, such as an organization ID ({!$Organization.Id}) or running user ID ({!$User.Id}). Visual Workflow global variables are only available in flow formulae.
Collection variable This is used to store values with a single data type. You can use a collection variable as a container in the Flow to store and reference multiple values at once.
SObject Variable This is used to store a record for a specified object. Use an SObject variable as a container in the Flow to store, update, and reference field values for a record.
SObject Collection Variable This is used to store multiple records for a specified object. Use an SObject collection variable as a container in the Flow to store, update, and reference field values for multiple records.
Constant This is used to store a fixed value.
Formula This is used to calculate a value from other resources in the Flow.
Text templates This is used to store formatted text with merge fields that refer to resources.
Choice This represents an individual value that can be used in a variety of screen fields.
Dynamic record choice This looks up data from an object's record and dynamically generates a set of choices for screen fields at runtime. When referenced as a resource, a dynamic choice value is determined by the most recent user selection of a choice within the generated set. For example, display all contacts from an account if a user entered a valid account ID.
Element Any element that you add to the Flow is available as a resource with the visited operator in outcome criteria. An element is considered to be visited if the element has already been executed in the Flow interview.
Global constant This is used to store fixed system-provided values, such as EmptyString, true, and false, that can be assigned as the values of Flow resources.
Outcome For the Decision element you have added to the Flow, its outcomes are available as Boolean resources. If an outcome path has already been executed in the Flow interview, the resource's value is true.
Picklist values These are system-provided values that are available as resources only in Assignment and Decision elements when selecting values for or to compare against picklist fields in SObject variables and SObject collection variables.
Picklist Choice This is used to store picklist or multi-select picklist values, those are generated from standard or custom object picklist or multi-select picklist field.
Screen field This is the field that you add to the Flow is available as a resource.
System variable These are system-provided values that can be referenced as resources, such as {!$Flow.CurrentDate}, {!$Flow.CurrentDateTime}, and {!$Flow.FaultMessage}.
Wait element Wait element events are always available as Boolean resources. If an event's waiting conditions are met, the resource's value is true. If the event has no waiting conditions set, the resource's value is always true.

From Chapter 2, Creating Flow through Point and Click, we will start using these resources.

Flow connectors

A connector is used to establish the path between the Flow elements. A connector looks like an arrow that points from one element to another. There are several types of connectors available. They are as follows:

Label Sample Description
Unlabeled
This is used to identify which element to execute next.
Decision outcome name This is used to identify which element to execute when the criteria of a decision outcome are met.
Wait event name This is used to identify which element to execute when an event that's defined in a wait element occurs.
Fault This is used to identify which element to execute if the previous element results in an error.
Next element This is used to identify the first element to execute for each iteration of a loop element.
End of loop This is used to identify which element to execute after a loop element finishes iterating through a collection.

From Chapter 2, Creating Flow through Point and Click, we will start using these connectors.