
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
-
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:
STEP 1 - Salesforce Flow – Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- 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
- Select All Conditions Are Met (AND).
- Field: Opportunity Team Member | Provided_Temporary_Access__c
- Operator: Equals
- Value: {!$GlobalConstant.True}
Don'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.
- Under Start, select Add Scheduled Paths (Optional)
- Under SCHEDULED PATHS, click on the New Scheduled Path.
- Under Scheduled Path Details, enter the Label the API Name will auto-populate.
- Time Source: Opportunity Team Member: Created Date
- Offset Number: 2
- Offset Options: Hours After
- Click Done.
STEP 3 - Get the Records to Delete from opportunity Team Member
- Under Toolbox, select Element.
- Drag-and-drop Get Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Select the Opportunity Team Member object from the dropdown list.
- Select All Conditions Are Met (AND).
- Field: Id
- Operator: Equals
- Value: {!$Record.Opportunity Team Member Id}
- How Many Records to Store:
- Select All records
- How to Store Record Data:
- Choose the option to Automatically store all fields.
- Click Done.
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.
- Under Toolbox, select Element.
- Drag-and-drop Decision element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Under Outcome Details, enter the Label the API Name will auto-populate.
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- Resource: {!Get_OTM_with_CheckBox}
- Operator: Is Null
- Value: {!$GlobalConstant.False}
- Click Done.
Check 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
- Drag-and-drop Delete Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- For How to Find Records to Delete select Use the IDs stored in a record variable or record collection variable.
- Set Record(s) to Delete
- Record or Record Collection: {!Get_OTM_with_CheckBox}
- Click Done.
Responses