Salesforce Management System is an information system used in CRM to automate business processes like sales and marketing. To implement this, Force.com developed a powerful tool called Visual Workflow to automate business processes by creating applications called Flows.
Learning Salesforce Visual Workflow, Second Edition is a practical guide on Flows that will enable you to develop custom applications in Salesforce with minimized code usage.
The book starts with an introduction to Visual Workflows that teaches all the building blocks of creating Flows and how to use Flow efficiently. You will learn how to easily automate business processes and tackle complex business scenarios using Flows. The book explains the working of the Process Builder so you can create reusable processes. The book also covers how you can integrate existing or, newly created Flows with the Salesforce Lightning Experience.
By the end of the book, you will get a clear understanding of how to use Flows and Process Builder in your organization to optimize code usage. This book will also help you in preparing for yourSalesforce certified platform app builder examination.
What’s New
Over the past few months, I have spent a LOT of time updating the book. I made hundreds, if not thousands, of changes throughout the book – from big to small. For example, many of you provided me with hundreds of comments and suggestions; and, in this book, I have tried my very best, to incorporate almost all of them. Furthermore, I have added two new chapters – “Building efficient and performance optimized Processes” and, “Enabling Flows to work with Lightning Experience” to explain new concepts. I also did a major revamp to almost all of the chapters. I am especially excited about the app that I have discussed at the end of the book to show how easily someone can create an application (punch in/out) using Flow (plus a bit of Apex code).
Here’s a taste of what you’ll uncover:
Develop an application using point and click with the help of Flow.
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.