Flows in Salesforce
Flows in Salesforce are an automated application that captures all data and performs the necessary actions in the system.The actions can be Sending an Email, Posting a chatter, Sending custom Notifications &, etc.The Salesforce flow simplifies complex business processes using click, not code.
Flow works with the help of elements, connectors, and resources.
Elements are any actions that the flow can execute, including subflows. Examples include reading or writing Salesforce data, displaying information to and collecting data from flow users, executing logic, or manipulating data.
Connectors are the defined paths that you specify that the flow will follow when it runs. For example, if a data update change corresponds with an email notification, you would use a connector to connect those two actions together.
Flow resources are values that you can use in the flow. For example, these could be objects (leads, contacts, companies) or fields (first name, last name, industry).
Interaction elements include Screen, Action, or Subflow.A Screen element, only available in a Screen Flow, allows you to present a screen to the user.Actions can be as Send Email, a Quick Create, or a custom Apex action.
Logic elements include Decisions, Assignments, Loops, Collection Sets and Collection Filter.
In Logics we can sort the data, filter the data and the Descion element helps to split the flow.Assignments allow you to give a value to a variable.
Data elements include Create, Update, Get, or Delete records.With the help of Data elements a record can be created, deleted, updated depending on the actions.
TYPES OF FLOWS
Example for Screen Flow
Scenario- Creating of Simple flow in the LMS app wherein with the entry of Staff name the data is updated in the staff object.In ideal scenario to enter the staff details we have to go to staff object and enter all the details and then Save it.
i)Go to setup in your salesforce org and in the Quick Find search for the Flows click on New Flow.
ii)Here we get the types of flows select the Screen Flow and click on Create.Change the layout from Auto Form to Free Form as it is more flexible to create a flow
iii)From the Interactions (to the left side) drag and drop the Screen element as we are creating a screen Flow.Provide the Label and the API name as staff Creation.Next is to drag the Text Element and Label it as Staff Name.And also go to Configure Header and hide the Previous and Pause button.
iv)Click on Done and connect the two elements i.e Start and Staff Creation Flow
v)Now the Screen is ready but the record has to be created.So for that drag and drop the Create Record Element from the DATA elements.Label it and Select the staff object as the record which is created has to be stored in the staff object.
vi)Join all the elements Save it and Name the Flow.Activate the flow before you run it.
vii)TESTING - When you enter the name for example name as Salesforce Staff and try to run the flow, the record gets updated in the object
So here the record is updated in the LMS app in the staff object and it is an easy approach to add a record in the database.We can do the same for the other object too.
Below is the screenshot of the Flow added to the home page. So when we enter the Staff Name and select Next so the Staff is created and its redirect to the Staff object.
This is how a screen flow is created and the flow can be placed on the UI
Call a flow from a button in Lightning
Salesforce has offered an easy way to trigger a flow using a Quick Action button in Lightning.
Create a custom action for the record in question by navigating to Object Manager > (Object Name) > Buttons, Actions and Links. Select “Flow” as the type for the custom action, configure the custom action to reference the flow, then name it. Then add the custom action to the page layout of your choice.