Salesforce Flow Introduction
The Salesforce Flows are an automated tool that gathers all data, records it, and then takes the appropriate actions. It is an automated application that gathers data and carries out the necessary system functions. The most effective tool an admin has in Salesforce is flows.
There are 3 main “building blocks” of any Flow:
1. Elements are the individual building blocks of the Flow. These perform logical actions such as assignments, decisions, or loops. There are also data elements that will query the database or commit record changes.
2. Connectors determine which element leads to which. Winter ’21 enables Auto-Layout, and connects the Elements together automatically.
3. Resources are the individual variables of data that are to be used in a Flow — these can be strings of text, numbers, records, formulae, or collections.
Types of FLOW in salesforce
There are 5 types of flow in salesforce that gives a more extensive way to resolve your problem.
Screen flow is use to guide a user to follow the business process or to take the input at the ral time from the end user.The gratest example is registration page, quick details page, contact us and many where user can easily forllow the business process and at the business side, business get the required information to execute the process.
Record Triggered Flow
This basically you can say the replacement of workflow and the processs builder.Record trigger flow executes when any record gets created, updated or deleted.
Note: For any object record trigger flow can be set only in three way
- Create/Update (Before)
- Create/Update (After)
- Delete (Before)
It is a kinf of sub flow.It runs on the backend.Sometimes called a headless flow because there is no GUI that a user interacts with.
These flows can be triggered automatically based on specific circumstances, as the name suggests. For instance, anytime any DML occurs, we can call a flow from the process builder (Insert, Delete, Update).
Auto launched flow can be called throught apex class and process builder.
Below is the way to call through apex class
Map<String, Object> daatasend = new Map<String, Object>(); Params.put('recordId','006p000000Aal2ertgfdf'); //-----create instance of the flow Interview
Flow.Interview.FlowName instanceflow = new Flow.Interview.GetOpprtunityStageName(daatasend);
//--------Invoke start method
//--------get value from Flow
string dataget=(string)instanceflow.getvariableValue(flow_variable); system.debug('Data get::: '+dataget);
Schedule Trigger Flow
An autolaunched flow can be made to run once, frequently, or regularly and can be scheduled to begin at a certain time. Indicate the object and the filter requirements that each record must satisfy in order for the scheduled flow to execute for the batch of records.
For each record in the batch, a flow interview is done, and all of the record’s field values are saved in the global variable $Record. Use the global variable $Record to gain access to the record’s field values while you construct the planned flow.
Platform Event- Triggered Flow
You can complete all of your automation in one place using platform event-triggered flows. A flow can be started by users when a platform event message is received. When a Flow is triggered by a platform event message, users can access every record, unlike Process Builder. Process Builder and Flow Builder have to be used in the past for platform event-driven automation.