Flow Builder in Salesforce

Flow Builder

Flow builder in Salesforce is an automation tool which is used to automate the business requirement process. Flow builder is similar to WorkFlow Rule and Process Builder with some advanced functionality in Salesforce. There are additional features included in flow builder which decrease the code for fulfilling the business requirement with the automation process.

In the Workflow rule, there are only four actions that automate your business process and in Process builder only 11 actions which are extensions of workflow rule. 

Limitation of Process Builder

There is functionality over which Process Builder is failed which are given as belows:

  • Process Builder only on a single Object and object which are related to this Object.
  • Process Builder cannot work on more complex actions
  • Process Builder cannot work on Deleting set of records
  • Process Builder cannot work on custom rollup summary action

These all types of work done by Flow builder like delete set of records, work on multiple objects and custom rollup summary actions.

Types of Flow

After the release of salesforce 20 type of flow increased to 5 which are:

  • Screen Flow

  • Record-Triggered Flow

  • Schedule-Triggered Flow

  • Platform Event—Triggered Flow

  • Autolaunched Flow (No Trigger)

Screen Flow is used for the user interaction when users want to create records in Salesforce like to create a registration form and Autolaunched Flow are basically used to perform action internally. 

Example of Flow Builder

1 Send an HTML Template by Email:

 

Problem:

Create a one-click solution to update the case status to closed and also send out a confirmation email (Using HTML Email Template) to the customer.

Solution:

Create a HTML email template and email alert with Name: 

Flow: Case Closed Email Notification with Template

Drag-and-drop Update Records element onto the Flow designer

Select the Case object from the dropdown list.

  1. Set Conditions
    1. Row 1:
      1. Field: ID
      2. Operator: Equals
      3. Value: {!VarT_CaseID}
  2. Set Field Values:
    1. Field: Status
    2. Value: Closed

Add email alert action with flow:

  1. Drag-and-drop Action element on the Flow Designer. 
  2. Search for Close Case Email Notification and select it. 
  3. Enter Label the API Name will auto-populate.
  4. Set Input Values:
    1. RecordId: {!VarT_CaseID}

2 To count number of Contact records 

 Problem:

 To count number of Contact records where Mailing city equals Delhi 

Example by code: 

         List<Contact> myContact = new List<Contact>();

        myContact = [Select id, Email from contact where Mailingcity =‘Delhi’];

        system.debug(‘Size of List’+myContact.size());

Solution: 

Flow: Contact Record count in Flow

 Create a flow variable number Datatype

drag and drops the Get Records element onto the canvas

Object: Contact

Fields:

    MailingCIty equals Delhi

drag and drops the Assignment element onto the canvas

3 Upload File by Flow

Problem: 

 To create a Flow that allows reps to create Leads and upload their business cards from it

Solution:

Create a screen Flow

Add two components to store Name(First name, Last Name), and Company

Drag and drop the Create Records element onto the canvas

     Add the fields those created in Screen components

Create again a screen component and add the File Upload components

4 Create FeedItem

Problem:

 A requirement to post Opportunity details (with Opportunity link) to the related Account’s feed, whenever an Opportunity gets created with an amount greater than $100k.

Solution:

Use Process Builder and Flow to solve it

Flow:   Post to Chatter Feed of Related Record

Drag Create Record Element

  • Select object FeedItem
  • Body= An Opportunity gets created with amount more than 100K
  • LinkUrl= https://na17.salesforce.com/{!VarOpportunityID}
  •          ParentId= {!VarAccountID}
  •          Title= {!VarOpportunityName}
  •           Type= LinkPost

Launch a Flow from Process Builder

Criteria: 

  •  [Opportunity].AccountId Is null Boolean False
  • [Opportunity].Amount Greater than or equal Currency $100,000.00