Salesforce Flow

Schedule Your Path in Salesforce Flow | Developer Guide

Advantages of Flow Builder over Process Builder

  • Process builder does work on delete the records
  • Flow work on a different object while Process Builder only work on related Object
  • Flows allow you to add screens where users can enter data
  • Process Builders do not have this capability.

Types of Flow

Types of Flow
  • Auto launched Flows

These flows are used to run automated tasks. Auto launched Flows can be invoked from process builder, from within an apex class, from a set schedule, from record changes, or from platform events.

  • Record-Triggered Flow

Launches when a record is created, updated or deleted. This auto launched flow runs in the background.

  • Platform Event-Triggered Flow

Launches when a platform event message is received. This auto launched flow runs in the background.

Logics in Flow

  • Assignment
  • Decisions
  • Loops

Data in Flow

  • Create Records
  • Update Records
  • Get Records
  • Delete Records

FSA 962 Salesforce Flow POC

Objective:  Is it possible to use flow in such a way where an Opportunity team member is an auto removed from the Opp Team after 2 hours.

To execute this function, we have to create a Record-Triggered Flow where the trigger event is when the record is created. There is a Flow: FSA 962 Remove Verifier From OTM which fulfill our requirement to remove Verifier from Opportunity Team that given below:

Salesforce Flow

STEP 1 - Salesforce Flow – Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option and click on Next and configure the flow as follows: 
    • How do you want to start building: Freeform
    • Trigger the Flow When: A record is created
    • Run Flow: After the record is saved
    • Object: Opportunity Team Member
  5. Select All Conditions Are Met (AND)
    • Field: Opportunity Team Member | Provided_Temporary_Access__c
    • Operator: Equals
    • Value: {!$GlobalConstant.True}

Opportunity Team Member

dont miss out iconDon't forget to check out: Salesforce Flows | How to Loop on Multi Select Picklist Values in a Flow?

STEP 2 - Schedule time to Delete the Opportunity Team Member

In this STEP, we will set a time to remove Verifier from the Opportunity Team after 2 hours of creating records

  1. Under Start, select Add Scheduled Paths (Optional)
  2. Under SCHEDULED PATHS, click on the New Scheduled Path.
  3. Under Scheduled Path Details, enter the Label the API Name will auto-populate.
  4. Time Source: Opportunity Team Member: Created Date
  5. Offset Number: 2
  6. Offset Options: Hours After
  7. Click Done.

Records to Delete

STEP 3 - Get the Records to Delete from opportunity Team Member

  1. Under Toolbox, select Element
  2. Drag-and-drop Get Records element onto the Flow designer
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Select the Opportunity Team Member object from the dropdown list.
  5. Select All Conditions Are Met (AND)
    • Field: Id
    • Operator: Equals
    • Value: {!$Record.Opportunity Team Member Id}
  6. How Many Records to Store:
    • Select All records
  7. How to Store Record Data:
    • Choose the option to Automatically store all fields
  8. Click Done.

Record Collection

STEP 4 - Decision to check collection Record Collection variable

In this step, we will check the Record Variable from STEP 2 to find if it returns the Opportunity Team Member Id or not.  

  1. Under Toolbox, select Element
  2. Drag-and-drop Decision element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Under Outcome Details, enter the Label the API Name will auto-populate.
  5. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    • Resource: {!Get_OTM_with_CheckBox}
    • Operator: Is Null
    • Value: {!$GlobalConstant.False}
  6. Click Done.

Delete Records

dont miss out iconCheck out another amazing blog by Aditya here: How To Resolve When Salesforce Error Apex Heap Size Too Large

STEP 5 - Delete/Remove Verifier from Opportunity Team Member

  1. Drag-and-drop Delete Records element onto the Flow designer
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. For How to Find Records to Delete select Use the IDs stored in a record variable or record collection variable.
  4. Set Record(s) to Delete
    • Record or Record Collection: {!Get_OTM_with_CheckBox}
  5. Click Done.

edit delete records

 

Responses

Popular Salesforce Blogs