SEOSEO News

Salesforce “Flow” and Debug Importance / Blogs / Perficient


What Is a Salesforce Flow?

Salesforce flow is an application inside Salesforce that will help you automate your business process easily using point-and-click or a declarative approach without writing a single line of code.

Flow empowers you to build complex business solutions using clicks, not by code, and reduces repetitive tasks. Flow builder is the most powerful tool that a salesforce admin has at their disposal, giving you similar powers to that of salesforce developers. Flows help us to create intuitive interfaces for users.

The 5 types of Salesforce Flows

Screen Flow

It guides users through a business process, and it can be launched from lightning pages, experience cloud sites, quick actions and it can be used in lightning web components. It is the only flow that interacts with the user. The user can provide their input.

Record-Triggered Flow

Launches when a record is created, updated, or deleted. This flow is initiated automatically and operates in the background.

Schedule-Triggered Flow

Launches at a specified time and frequency for each record in a batch. This flow is initiated automatically and operates in the background.

Platform Event

Launches when a platform event message is received. This flow is initiated automatically and operates in the background.

Auto-Launched Flow

Launches when invoked by Apex, Processes, and REST API. This flow is initiated automatically and operates in the background.

 

Let’s Understand Flow With a Use Case

Business Use Case

The car manufacturing company builds different types of cars. Since they are a very big company, they have many sales representatives across each region in the world. The primary work of the sales representative is to sell as many cars as possible to different customers by bringing leads into the company.

Now the car manufacturing company faces a problem since it has to “manually” recognize good sales performance individuals and provide incentives to salespersons each month by evaluating the performance of every sales representative and sending an email individually (Manual process). This required a lot of time and effort to complete the process.

Solution

The car manufacturing company opted for the salesforce flow to automate the above business process. The salesforce flow created to solve this particular use case, this use case will be running at the end of every month which takes all the metrics and sends an email to the particular sales representative automatically after evaluating the conditions.

Why Do Businesses Opt for Salesforce Flow Rather than the Process Builder or Workflow Rules?

As we all know, Salesforce evolved over the years. Salesforce introduced workflow rules first to automate the business processes, then replaced them with the process builder over time. The process builder had a better user interface and capabilities than the workflow rules. The Salesforce flow had all the advantages of process builder and workflow rules and now flow lets us run all the automation using a single tool. Salesforce flows are used largely if there are more complex business processes to be automated.

General Differences

Flow Advantages

Triggering Point Advantages of Flows

Flow Advantages 1

 

Importance of Flow Builder

Flow builder tools help us to create salesforce flows. In flow building, elements are essential in building flows. The elements are the actions that help us to perform in our salesforce flow. Different elements are used to create a flow per the use case to solve the business problem.

Whenever we create a flow, we need to activate it for the flow to function and vice versa to deactivate it. If we don’t want to delete a flow, we can just deactivate it if there is no use for the flow.

The Flow Elements are Categorized as Below

  1. Interaction elements
  2. Logic elements
  3. Data elements

For the flow to function well, we need “resources” to be created first for the elements to communicate with purpose. Below are the types of resources

  1. Variables
  2. Constant
  3. Formula
  4. Text template
  5. Choice
  6. Record Choice set
  7. Screen components
  8. Picklist choice sets

Let’s familiarize with the sequence of flow that will be incorporated during the use case

1. Interaction

  • Screen flow
  • Action
  • Sub flow

Based on the user requirement, we choose the type of flow that we need to use, and to connect one element to other elements, we use connectors. Theoretically start element where the flow begins

Sequence of flow

 

2. Logic

  1. Assignment
  2. Decision
  3. Loop

Element Loop

  • Element Loop:  We use a loop to run the same action many times or repetitive tasks. When we call a loop each time, one iteration occurs. The loop consists of 3 parts
  • Start condition – If a new iteration should start
  • current item- Current target for the action
  • Action: Things that actually happen
  • After each iteration, the system goes back to the start position to see if the new iteration needs to start. If not, the loop ends. We can select the collection variable and specify the direction for iteration over a collection (first to last /last to first).
  • Flow 3 decision Element and assignment ElementWe also use decision element at the start of the condition and
  • Use the assignment element to define the current item.

DML operations which are available in flow:

3. Data elements

  1. Create records
  2. Update records
  3. Get records
  4. Delete records

 

Get Records

You can get a Record of any object. As per our requirements or in order to get the records for the flow, we can choose our conditions requirement or a custom condition can be set. For example, we can select All conditions are met (AND) / any conditions are met(or). Since we get the record, it allows us to choose the sort order and sort by using the fields to get accurate records. We can also select the fields that need to be shown as output.

“Get records is used to query data, so it will cost 1 SOQL query”

Create Records

we can select how many records can be created (one or multiple records). It also helps us create a new field value, or we can use the constant or variables created from the flow. We can be able to create a multiple record using a collection.

Since creating records is used for creating data, it will cost 1 DML statement

Delete Records

We can delete a single record or a collection record. Depending on our requirements, we can use record variable or record variable collection to delete a single or collection record. When we use specific conditions, we can choose a particular condition and value to delete.

By using record variables = 1 DML

By using specific conditions = 1DML + 1 SOQL

Update Records

We can be able to update a single record or multiple records. In a flow, we can also use a get record and an Assignment record to finally update the record. Updating the records can be via using triggering record or by using a variable or by specific conditions

After save

using triggering record = 1DML

by using a variable = 1 DML

Specific conditions = 1SOQL+1DML

Debug importance

When you are testing a flow that you are building out or troubleshooting the flow that fails we should know how to debug it directly in your flow builder. This is a very important step before flow activation or going to the production environment. Debugging also helps us to eradicate the failures in the flow. In case a debug fails, the admin can build the conditions that are suitable for the requirements. The debug will highlight the correct path of the flow if the flow is successful or not. The debug button in the flow builder can solve this problem with ease. Before we start testing, draft a list of test cases, and identify what we expect the result to be. Consider things like:

  • When we expect actions to occur
  • When we expect actions to not occur
  • How formulas should resolve

Debug importance

 

Flow after Debugging Identifies the Below Details

Since we started the flow, the first card identifies “who started the flow interview”

NOTE: A flow interview is nothing but an instance of a flowInterview

 

The second card summarizes how the input from the screen was stored for the flow interview to use.

Second card

 

The third card summarizes the Create Contact element. The interview created A contact record using the values in the {!contact} variable.

 

Final card

Once the above debug testing is done, please follow the below to review if the contact has been updated or not

  1. Confirm that the Transaction Committed card appears at the end of the debug details.
  2. Click the contact tab and see if the input first name and last name provided are updated in the specific record

In the event that any test case yields unexpected results, utilize the debug details to trace the error and determine the cause.

We now understand the salesforce flow and flow builder, and it is important to debugging. In the future Salesforce flow will be predominantly used to solve complex business problems.

 





Source link

Related Articles

Back to top button
error

Enjoy Our Website? Please share :) Thank you!