Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Visual Work Flow

    • Add Record to Multiple Chatter Groups – Parsing Multi-Select Picklist fields (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. CollaborationGroupId represents Id of Chatter Group and RecordId represents 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

      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

      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

      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

      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

      Add Record to First Chatter Group

      7. Now drag-and-drop Decision element to check counter size. If Counter size < = 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

      Check the counter size

      To check the counter size

      8. As we have already added the record to one Chatter Group then we have to TRIM original length (it means remove selected Chatter group ID from variable {!VarTOpportunityID}. Please refer to the following screenshot for more details

      Screen Shot 2018-12-11 at 2.19.13 PM

      Assign remaining Chatter Groups IDs to Text Variable

      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

      Add details into SObject Variable

      10. Drag-and-drop Assignment Logic (Give the name All in one) on the window and assign a value from SObject 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

      Add SObject Variables into a SObject Collection

      11. Next step is to check Counter size >= 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

      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

      Add record to remaining Chatter Groups

      13. Finally, our Flow will look like the following screenshot

      Add Record to multiple Chatter Groups

      14. Save the flow with name Add Record to multiple Chatter Group and close the canvas.

      It’s time to test this flow

      In the next article Call a flow from publisher action I will show you how you can use this flow as Publisher action

      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

      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 4 Chatter Groups

      Selected Chatter 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

      Final Output

      Note:- In the next article Call a flow from publisher action I 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.

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Chatter, Sales cloud, Salesforce Flow, Spring'15 Release | 20 Comments | Tagged Add new record to Chatter Group, Add Record to Multiple Chatter Groups, Add Record to Multiple Chatter Groups flow, Add Records to Chatter Group, ADM 201, advance developer, Advance flow, Assignment element in Flow, Auto Add new record to Chatter Group, Auto Add Records to Chatter Group, Call flow from publisher action, Chatter and Flow, Chatter and Visual workflow, Chatter and Visual workflow example, Chatter Group, Cloud Flow Designer Workbook, CollaborationGroup, CollaborationGroupRecord, Decision element in Flow, dev 401, dev 501, Fast Create in Flow, flow, Flow basics, Flow Example, Flow varibale, Formula in flow, Opportunity, Parse, Parse MSP to a collection Flow, Parse MSP to collection variable flow, Parse multi-select Checkboxflow, Parse multi-select picklist flow, Parse multi-select picklist to Collection, Parsing in flow Salesforce, Parsing Multi-select checkboxin Flow, Parsing Multi-select picklist in Flow, Record Create in flow, Records to Chatter Group, salesforce, salesforce chatter, Spring'15 Release Salesforce, Universal container, Visual flow, Visual flow Rockstar, Visual Work Flow, Visual workflow, Visual workFlow examples, Visual Workflow Flow Cloud Flow Designer, Visual Workflow Implementation Guide
    • Auto Add/Remove Permission Set – Part 2

      Posted at 4:26 PM by Rakesh Gupta, on August 14, 2014

      In the last article Auto Add/Remove Permission Set – Part 1 I have gone through the way to automate Assign Permission Sets process based on user defined criteria. In this article I will discuss a way to automate Unassign Permission Sets based on criteria.

      Business Use Case

      Management in Universal Container wants to automate permission set removal or Unassigned process so that their admin workload will be reduced.

      Solution for the above business requirement

      In this article, I will discuss how to auto Unassign/Remove Permission Sets from the user. First of all, create few fields on the User object to save condition to auto Unassign/Remove Permission Sets to the user. In this demo, I will create a few fields on the User object as shown in the below screenshot

      Custom Fields on User object

      Custom Fields on User object

      To solve this requirement we will use Visual Workflow and Workflow Rule (i.e Headless Flow).  Before going ahead with the solution you have to understand about PermissionSetAssignment Object. It represents the association between a User and a Permission Set. Below are the key fields from PermissionSetAssignment object

      Field Name Details
      PermissionSetId ID of the PermissionSet to assign to the user specified in AssigneeId.
      AssigneeId ID of the User to assign the permission set specified in PermissionSetId.

      To develop this application follow the below instructions

      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 UserID (To pass User ID) and RemovalPermissionsetID (To pass  ID  of permission set which system admin want to remove from user)
      3) Drag and drop a Record Delete ( Give the name Delete Permission Set) onto the window to assign permission set to user and map the fields according to below details

      • Select Object PermissionSetAssignment
      • AssigneeId=  {!UserId}
      • PermissionSetId= {!RemovalPermissionSetID}, You can take help from the following screenshot
      Remove Permission Set

      Remove Permission Set

      4) Finally, our Flow will look like the following screenshot

      Remove Permission Set

      8) Save the flow with name Remove Permission Set and close the canvas.

      Create Workflow rule to fire our Flow

      Our next task is to create a workflow on the User object on the creation and every time it’s edited event. To create a workflow on the User object follow the below instructions

      1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
      2) Select object  User from the drop-down
      3) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time-dependent workflow), For Rule Criteria select End Date != False  and  Remove = False as shown in the following screenshot

      Workflow Rule1

      Workflow Rule1

      4) Now Add a time trigger to set Remove flag True after 0hr of End Date. To do this click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, I selected 0hr after the End Date. Now add one field update action for time-dependent workflow and set Remove flag to True. You can take help from the following screenshot

      Time based action

      Time-based action

      5) Save the workflow and activate it.
      6) Create another workflow (i.e. workflow Rule2 ) on the same object to fire our Flow, set entry criteria of trigger is Remove = True

      Workflow Rule2

      Workflow Rule2

      7) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow (Remove Permission Set) and set Variable (UserID and RemovalPermissionsetID ) value as shown in the following screenshot

      New Flow Trigger Action

      New Flow Trigger Action

      8) Add one Immediate Workflow Actions i.e. New Field Update and Set Remove flag to False.
      9) Save the workflow and activate it.

      It’s time to test this feature

      1) Go to the User’s detail page to whom you want to Unassign Permission Sets and fill the detail. In this demo I am going to Unassign Permission Sets with Name “Test“,  it will look similar to below screenshot

      Permission Set Removal Detail

      Permission Set Removal Detail

      2) To check time-dependent workflow queue Follow the path, Click on Name | Setup | Administration Setup | Monitoring | Time–Based Workflow and search the queue

      Time-Based Workflow Queue

      Time-Based Workflow Queue

      Note: -I will suggest you Implement this first on your developer org test it and then move it to Production. Let me know if you have any difficulty to Implement it.

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Salesforce Flow, User Management | 0 Comments | Tagged ADM 201, adm 201 certification, adm 201 salesforce, Advance flow, Auto Add/Remove Permission Set, auto remove Permission Set, Auto remove permission set based on date, auto remove permission set from user, Auto remove Permission Sets in Salesforce, Auto revoke permission set access, Auto revoke permission set on future date, auto Unassign Permission Set, auto unassign permission set based on date, Cloud Flow, Cloud Flow Designer Workbook, Con 201, dev 401, DEV401, flow, Flow Designer, Flow examples, Flow exmple, Flow Triggers For Workflow, FlowRockstar, FlowTrigger, FlowTriggerPilot, FlowX Flow Triggers, headless flow, Headless Flows, New Flow, PermissionSetAssignment, PermissionSetId, Record Create, remove permission set, Remove permission set based on date, Remove permission set from user, remove permission set in future, remove permission sets, Revoke permission set access, Salesforce Flow, Screen, screenshot, Sp14FlowHackathon, Trigger Flow, Trigger ready flow, Unassign Permission Set, Visual flow, Visual Work Flow, Visual workflow, Visual workFlow examples, Visual Workflow Flow Cloud Flow Designer, Visual Workflow Implementation Guide, workflow rule
    ← Older posts
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 54 (Auto-follow a Chatter Question After Reply)
      • Getting Started with Salesforce Flow – Part 53 (Clone a User with their associated Public Group, Queue Membership and Permission Sets)
      • Getting Started with Pardot – Part 14 (How to Use Pardot Form Handlers)
      • Getting Started with Salesforce Flow – Part 51 (Add a Flow to a Lightning Page)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Salesforce Spring’21 Release Quick Summary
    • Learning Flow
    • Getting Started with Salesforce Flow – Part 53 (Clone a User with their associated Public Group, Queue Membership and Permission Sets)
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • Getting Started with Salesforce Flow – Part 31 (Auto Submit Record into Approval Process with Flow)
    • About Me
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
    • Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows)
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub