We will be able to :
-
1. Create Flows by Yourself
-
2. Understand why the flow was introduced in the world when we already got Workflows, Process Builder, Triggers.
What is a Flow?
A Flow is a tool to automate the business process.
Why are Flows introduced?
We got Apex, Triggers, Lightning Components , Lightning Web Components with these things we can perform any implementation. There is a topic which is we need to know how to code.
Let's say I don't know how to do code but still want to do some implementation. Here Salesforce comes up with some features, out of which the first is the Workflow. We don't know the code, but we can perform actions. However, there is a limitation of four actions, but we can do more if we add Process builder to the Salesforce. That's where we can perform 11 actions more than workflows do. But process builder is also limited. For example, we can not delete a set of records; we can not do a custom roll-up summary action, not clone a record. So these things the process builder can not handle, so to do that we can do with the help of Apex trigger, Lightning and Lightning Web Components until we got a new one which is “Flow”.
Flows is a powerful tool because flows can build UI Screens; no other standard tools can do it. This makes it easy to add registration forms. We can make approval rules. It can also perform complex actions like deleting records, cloning records, and performing custom roll-up summary actions.
There are two types of flow:
1. Screen Flow
2. Auto Launched Flow
How do we need to select flow type?
Whenever a customer screen has to be implemented, we will first go for Screen Flow.
E.g. Create registration form, Create a Feedback form, Approval Steps
Scenario 1: Display “Hello World” Text on home page using screen flow.
We will print the message on the screen at the Assistance Box
In the New Hello World Flow flow, open the screen.
-
1. From Setup, enter Flows in the Quick Find box, and select Flows.
-
2. Click on New flow.
-
3. From the Flow type select Screen Flow
-
4. Click on Create
-
5. We need to drag and drop screen option
-
6. Uncheck Header and Footer from Configure Header Footer
-
7. Set Label Name : Message Screen
-
8. Set API Name: Message_Screen(Default)
-
9. From the Display select “Display Text” drag and drop on the box
-
10. In the message box Type “Hello World”
-
11. Font size : 20
-
12. Font type: Bold
-
13. API Name: displayText
-
14. Click on Done
-
15. Connect the Message Screen with Start
-
16. Click on Done
-
17. Connect the Message Screen with Start
-
18. Click on Save
-
19. Flow Label: Hello World Flow
-
20. Flow API Name: Hello_World_Flow
-
21. Click on Save
-
22. Review and Issues : Close
-
23. Click on Activate
-
24. Click on Back
-
25. Display the message Click on Home page
-
26. Click on Setup and select Edit Page
-
27. Drag and Drop a Flow at Assistant Box
-
28. Select Hello World Flow at Flow
-
29. Click on Save
-
30. Click on Activate
-
31. Select Assign as Org Default
-
32. Click on Save
-
33. Click on Home Page
-
34. Click on Save
-
35. Go back and click on Home
2. Auto Launched Flow: Auto Launched Flow launches when invoked by Apex, Process Builder or even REST API.
-
1. Schedule Trigger Flow: This flow launches when record is created , deleted or updated
-
2. Record Trigger Flow:This flow launches when record is created , deleted or updated
-
3. Platform Event Flow:This flow launches when record is created , deleted or updated
-
4. Auto launched Flow: Launches when invoked by Apex, Process Builder or even REST API
Scenario 2 :Create a Contact associated with an Account using the Autolaunch flow.
In the New Contact Account Autolaunch flow, open the screen.
-
1. From Setup, enter Flows in the Quick Find box, and select Flows.
-
2. Click on New flow.
-
3. From the Flow type select AutoLaunch Flow and Click Next
-
4. Click Manager-> New Resource
-
5. Resource Type: Variable
-
6. DataType: Text
-
7. Available for Input: Checked
-
8. Click Done
Creating a Contact that is associated with Account record.
-
1. Click on Create Records
-
2. Set Label: “Create Contact” API Name: “Create_Contact”
-
3. How to set Record Fields: Select - Use Separate resource, and literal Values
-
4. Object: Contact
-
5. Set Fields for the Contact
-
6. Field : Last Name Value: Test Last Name
-
7. Field : First Name Value: Test First Name
-
8. Field : AccountId Value: {!accountId}
-
9. Done
-
10. Link with Start
-
11. Save
-
12. Flow Label : Create Contact With Process Builder
-
13. Flow API Name: Create_Contact_With_Process_Builder
-
14. Done
-
15. Click on Activate
-
16. Quick Find Process Builder
-
17. Click on New
-
18. ProcessName : Account Processing for Flow
-
19. API Name: Account_Processing_for_Flow
-
20. The Process Starts When : A record changes
-
21. Click on Save
-
22. Add Object: Object -> Account
-
23. Start the Process: Select “Only when a record is created”
-
24. Click on Save
-
25. Click on Add Criteria
-
26. Criteria Name: Always Run Account
-
27. Select : No criteria—just execute the actions!
-
28. Click on Save
-
29. Immediate Action Click on Add Action
-
30. Select Action Type : Flows
-
31. Action Name : “Calling Flow”
-
32. Flow : “Create Contact With Process Builder”
-
33. Click Add Row
-
34. Flow Variable : accountId Type: Field Reference Value: [Account].Id
-
35. Click on Save
-
36. Click on Activate
-
37. Click Confirm
Now here we can create a new Account automatically associated with contact.
Create an Account:
-
1. Click on Account
-
2. Click New
-
3. Account Name: “Test Account for Flow”
-
4. Click on Save
Now we will see that contact is automatically created with the FirstName and LastName