In this blog post let’s discuss how to add a flow in the lightning page to distribute to Lightning Experience or Salesforce app Users.
Objectives:
This blog post will help us to understand the following
Add a flow to the lightning record page
define the filter condition to show the flow to specific users
Business Use Case
Brenda David is working as a System administrator at Gurukul on Cloud (GoC). She has created a flow that allows their sales users to add an opportunity to multiple Chatter Groups. She has the following requirements:
Make the flow accessible from the Opportunity lightning record page
Flow is only available for users who have the Standard User profile
Automation Champion Approach (I-do):
Any active screen flow can be added to a lightning page. In the scenario, we will add a ScreenFlow which we created in this article to an opportunity lightning record page.
Things to Remember:
Only active screen flows are available to be added to the lightning record page.
By default, flows display in one column.
Flow’s input variables appear only if they allow input access.
Pass record ID into this variable – This option is available only for Text input variables in Record pages. For simplicity, I recommend passing the ID to only one variable.
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.
Let’s begin building this automation process.
Guided Practice (We-do):
There are 2 steps to solve Brenda’s business requirement using Screen Flow and Flow Component. We must:Read the rest of this entry!
Posted at 10:15 PM by Rakesh Gupta, on February 3, 2015
In Spring’15 release Salesforce added a new feature on Chatter, that is Add records to Chatter Groups. In the last article Automatically add records to Chatter Group” I had discussed the way to automate this process. In this article, I am going to discuss how you can allow your users to add a record to multiple Chatter Groups and I am also going to discuss a way to parse Multi-Select choice Picklist fields.
Business Use Case
Higher Management in Universal container wants to expand new feature “Add records to Chatter Groups” for their users. Basically, they want a publisher action on Opportunity object that allows their users to add a record to multiple Chatter Groups (Only public Groups).
A solution for the above business requirement
Do you think we have to use Apex code to parse values selected for multi-select choice fields in flow? I think no, this article will help you to understand the way to assign multi-select choice picklist values to a collection variable in a flow or way to parse it.
Design: – when a user clicks on publisher action on Opportunity object it will pop-up a screen, then the user can select multiple Chatter groups, after clicking on Next button it will add Opportunity record to Selected Chatter Groups.
To solve this requirement we will use Visual Workflow, and then we will embed Flow to a Visualforce page to call it from Publisher action. Before proceeding you have to understand CollaborationGroup and CollaborationGroupRecord objects in Salesforce.
A. CollaborationGroup:- This object represents a Chatter group.
B. CollaborationGroupRecord:- This object represents the records associated with Chatter groups. CollaborationGroupIdrepresents Id of Chatter Group and RecordIdrepresents ID of the record associated with Chatter Group.
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows 2. Click on New Flow, it will open flow canvas for you. Create two Text type variable VarTOpportunityID (To pass Opportunity ID from Publisher action) and VarTSelected_Chatter_GroupsID we will use it later on this flow. 3. Next step is allowing users to select multiple Chatter Groups. To do that drag-and-drop a Screen Element ( Give the name Select Chatter Groups) onto the window and add a Dynamic choice Multi-Select Picklist field with below detail
Name
Data Type
Required
Active Chatter Group (Public)
Multi-Select Picklist
Yes
It will look like the below screenshot
Dynamic choice Multi-select picklist
Note:- Don’t save the selected Chatter group IDs, because if you assign the results to a variable here, that variable will only store the first value selected.
4. Next step is to assign ID’s of Selected Chatter Group to Text variable {!VarTSelected_Chatter_GroupsID}, to do that Drag-and-drop Assignment Element ( Give the name Chatter Groups IDs to Variable) onto the window and map the field according to the following screenshot
Assign Selected Chatter Group IDs
5. Next task is to create few Formula fields to calculate the number of chatter groups the user has selected, it’s length, Individual Chatter group ID and for Id’s that remaining to Parse. First, we will create a formula to calculate Lengths of ID’s of Selected Chatter Groups (Length) and Number of Chatter group selected (Counter) as shown in the following screenshot
Formula Fields – Part 1
Now create two formula fields to calculate Parsed ID (Single_Chatter_Group_ID) and Chatter ID’s those are remaining to Parse (Remaining_Chatter_GroupID) as shown in the following screenshot
Formula Fields – Part 2
6. Drag-and-drop a Record Create ( Give the name Add Record to First Chatter Group) onto the window to add a record into chatter groups, if the user has selected only one Chatter group. Please refer to the following screenshot for more details
Add Record to First Chatter Group
7. Now drag-and-drop Decision element to check counter size. If Countersize < = 1 then leave it as it is, else we have to collect the remaining Chatter groups IDs and then add it to a SObject Collection Variable with recordID(To add records to Chatter Groups, in our case it’s variable {!VarTOpportunityID}. Please refer to the following screenshot for more details
To check the counter size
8. As we have already added the record to one Chatter Group then we have to TRIMoriginal length (it means remove selected Chatter group ID from variable{!VarTOpportunityID}. Please refer to the following screenshot for more details
Assign remaining Chatter Groups IDs to Text Variable
9. Next step is to add data into a SObject Variable after parsing it. Drag and Drop Assignment Logic (Give the name Add data for single Chatter Group Record) on the window, to assign {!VarTOpportunityID} and formula {!Single_Chatter_Group_ID} into the SObject Variable (CollaborationGroupRecord Object Type) {!Single_Record_Deatils}as shown in the below screenshot
Add details into SObject Variable
10. Drag-and-drop Assignment Logic (Give the name All in one) on the window and assign a value fromSObject variable {!Single_Record_Deatils} to SObject Collection variable {!All_Record_In_One} (CollaborationGroupRecord Object Type) so at the end of the flow will use it inside the Fast Create to add a record to remaining Chatter Groups. Please refer to the following screenshot for more details
Add SObject Variables into a SObject Collection
11. Next step is to check Countersize >= 1. If counter size is greater than 1 then repeat the process (8-10), else we will use Fast Create element add a record to remaining Chatter Groups. To do that drag-and-drop decision element and check the counter size, as shown in the following screenshot
Check Counter Size Greater than 1
12. Finally, drag-and-drop Fast Create (Give the name Add record to remaining Chatter Groups) on the window and map the field according to the below screenshot
Add record to remaining Chatter Groups
13. Finally, our Flow will look like the following screenshot
14. Save the flow with name Add Record to multiple Chatter Group and close the canvas.
1. For time being to test this flow, we will hard code the Opportunity Id into flow variable {!VarTOpportunityID}
Set Default Value to a Variable
2. Click on the Save, button and then click on Run button available on flow canvas. Select as many as Chatter Groups you want, as shown in the following screenshot I have selected 4Chatter Groups
Selected Chatter Groups
Once done Click on Next button.
3. To see the result, open the Opportunity Detail page and navigate to Groups related list
Final Output
Note:- In the next article Call a flow from publisher actionI will show you how you can use this flow as Publisher action. I will suggest you Implement this first on your developer org test it and then move it to Production.