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: CollaborationGroup

    • Getting Started with Salesforce Flow – Part 46 (Is Your Chatter Group Data Clean? No? Use Flow to Do So!)

      Posted at 2:42 AM by Rakesh Gupta, on December 5, 2020

      Big Idea or Enduring Question:

      How do you provide a way for deleting the Chatter group feed to the key users? 

      Chatter Group is primarily geared towards boosting collaboration among users within an organization. Similar to a public group, a Chatter group comprises a set of users. Indeed, one can add unlimited users to a Chatter Group.

      Some time the Chatter group is very cluttered that as a manager, you want to delete the old post. There are a few apps available on AppExchange for this purpose, but nothing comes out-of-the-box. In this article, we will create automation that allows users to delete a specific type of posts for Chatter groups.

      Objectives:

      This blog post will help us to understand the following

      • Use a Screen a flow to take the user input 
      • How to delete the records using the delete records element 
      • Understand how to create a custom permission
      • Understand how to use custom permission to hide a component 

      Business Use Case

      Brenda David is working as a System administrator at Universal Containers (UC). She has received a requirement from the management to create a wizard that allows a set of users to delete posts (created before a specific date) from Chatter groups. 

      Automation Champion Approach (I-do):

      While this can be solved using various tools:
      1. Manual Deletion
      2. Lightning Web Component 
      3. Apex Code
      4. Data Loader

      We will use Salesforce Flow to solve it. 

      Before proceeding, ahead, understanding CollaborationGroupFeed objects in Salesforce. It represents a single feed item on a Chatter group feed.
      Field Name Details
      ParentId The Id of a chatter post. 
      LastModifiedId It is the date and time when a record was last modified by a User.

      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 4 steps to solve Brenda’s business requirement using Screen Flow. We must:

      1. Salesforce Flow Steps: (Screen Flow)
        1. Create a text variable to store chatter group id
        2. Add a screen to capture the user data
          1. Add a screen component
          2. Add a Date component 
        3. Add a get record element to find collaboration group feeds created before a given date
        4. Add a decision element to check the record collection variable (from step 1.3)
        5. Add a delete records element to delete chatter posts
      2. Creating a custom permission
      3. Assign custom permission to the system administrator profile  
      4. Add flow to the chatter group page and add filter criteria 

      Step 1.1: Salesforce Flow – Create a Text Variable to Store Chatter Group Id

      The Screen flow which we are creating will be used in the Chatter group Page to delete posts. 

      1. Click Setup.
      2. In the Quick Find box, type Flows.
      3. Select Flows then click on the New Flow.
      4. Select the Screen Flow option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
      5. Under Toolbox, select Manager. Click on the New Resource. 
      6. Input the following information:
        1. Resource Type: Variable
        2. API Name: varTCollaborationGroupId
        3. Data Type: Text
        4. Default Value: {!$GlobalConstant.EmptyString}
        5. Check Available for Input
        6. Check Available for Output
      7. Click Done. 

      Step 1.2.1: Salesforce Flow – Add a Screen Element 

      1. Under Toolbox, select Elements. Drag and drop Screen onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
      3. Click Done. 

      Step 1.2.2: Add a Date Component to Allow Users the Enter Date to Delete Past Chater Posts 

      1. Under Input section on Screen Element. Drag and drop Date onto the screen. 
      2. Input the following information:
        1. Enter API Name.
        2. Label: Enter Date
        3. The API Name will auto-populate
        4. Require: True 
      3. Click Done.

      Step 1.3: Salesforce Flow – Adding a Get Record Element to Find Collaboration Group Feeds Created Before a Given Date

      1. Under Toolbox, select Element. 
      2. Drag-and-drop Get Records element onto the Flow designer. 
      3. Enter a name in the Label field; the API Name will auto-populate.
      4. Select the Record CollaborationGroupFeed object from the dropdown list.
      5. Select All Conditions Are Met (AND).
      6. Set Filter Conditions
        1. Row 1:
          1. Field: ParentId
          2. Operator: Equals
          3. Value: {!varTCollaborationGroupId}
        2. Click Add Condition
        3. Row 2:
          1. Field: LastModifiedDate
          2. Operator: Less Than or Equal
          3. Value: {!Enter_Date}
      7. How Many Records to Store:
        1. select All record
      8. How to Store Record Data:
        1. Choose the option to Automatically store all fields. 
      9. Click Done.

      Step 1.4: Salesforce Flow – Using Decision Element to Check the Record Collection Variable (from step 1.3)

      Now we will use the Decision element to check the Record Collection Variable from step 1.3 to find if it returns the record(s) or not. 

      1. Under Toolbox, select Element. 
      2. Drag-and-drop Decision element onto the Flow designer. 
      3. Enter a name in the Label field; the API Name will auto-populate.
      4. Under Outcome Details, enter the Label the API Name will auto-populate.
      5. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
        1. Row 1:
          1. Resource: {!Find_Feeds}
          2. Operator: Is Null 
          3. Value: {!$GlobalConstant.True}
      6. Click Done.

      Step 1.5: Salesforce Flow – Delete Records – Delete Chatter Group Posts

      The next step is to add a logged-In user to the chatter group. We will use the Create Records element. 

      1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
        2. How Many Records to Create: One
        3. How to Set the Record Fields: Use the IDs stored in a record variable or record collection variable
        4. Select Record(s) to Delete
          1. Record or Record Collection: {!Find_Feeds}
      3. Click Done.

      In the end, Brenda’s Flow will look like the following screenshot:

      Once everything looks good, perform the steps below: 

      1. Click Save.
      2. Enter Flow Label the API Name will auto-populate.
      3. Click Show Advanced.
      4. Type: Screen Flow
      5. API Version for Running the Flow: 51
      6. Interview Label: Clean Chatter Group {!$Flow.CurrentDateTime}
      7. Click Save. 

      Almost there! Once everything looks good, click the Activate button. 

      Step 2: Creating a Custom Permission 

      By using custom permissions, you can grant users access to custom apps. In Salesforce, you can use custom permissions to check which users can access certain functionality. Custom permissions let you define access checks that can be assigned to users via permission sets or profiles – similar to how you assign user permissions and other access settings. You can even use custom permission to bypass the validation rule for certain users or profiles. Let us create custom permission to hide the flow component. 

      1. Click Setup.
      2. In the User Interface, type Custom Permissions.
      3. Click on the New button.
      4. Enter Label the Name will auto-populate. 
      5. Click Save.

      Step 3: Assign Custom Permission to the System Administrator Profile 

      1. Click Setup.
      2. In the User Interface, type Profiles.
      3. Open the System Administrator profile. 
      4. Then navigate to Apps | Custom Permission and click on the Edit button.
      5. Now, assign the Clean Group Posts custom permission to the profile.
      6. Click Save.

      Step 4: Add a Flow to Lightning Page and Add Filter Criteria 

      The next step is to distribute a flow to Lightning Experience or Salesforce app users, by embedding it in a Lightning page.

      1. Navigate to App Launcher and click on the Groups.
      2. Open any Chatter Group and Edit the page.
      3. From the Lightning Components pane on the left, drag the Flow component onto the Lightning page canvas.
      4. Input the following information:
        1. Select Clean Chatter group flow
        2. for varTCollaborationGroupId
          1. Select Pass record ID into this variable checkbox
        3. Click + Add Filter
        4. Set Filter Conditions
        5. Row 1:
          1. Field: Permission > Custom Permission > Clean_Group_Posts 
          2. Operator: Equal
          3. Value: True
      5. Click Done.

      Once everything looks good, click the Save button. 

      Proof of Concept

        1. As of now UC Internal Announcements – Chatter Group has three posts that were created before November 19, 2020.
        2. Now let’s delete the chatter created on or before November 18, 2020.
        3. BOOM now checks UC Internal Announcements – Chatter Group Feed, are chatter posts created on or before November 18, 2020, were deleted.

      Formative Assessment:

      I want to hear from you!  

      What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? 

      Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.

      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, Salesforce Flow | 4 Comments | Tagged cahtter feed, Chatter, Chatter Free User, Chatter Group, Chatter Groups, CollaborationGroup, CollaborationGroupFeed, Custom link, data management chatter, Deleet feed, deleet lookup, dynamic choice, flow, Follow Chatter Group, Forcedotcom, Home page component, Home page layout, LastModifiedDate, Lightning Flow, Lightning Flow example, limit flow screen, mass deleet feed, New Flow, ParentId, resize flow, resize flow screen, salesforce, Salesforce Floe Example, Salesforce Flow, Screen
    • 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
    ← Older posts
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      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 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Streamline Data Collection with Salesforce-Connected Forms
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • 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

    • Learning Flow
    • Learning Process Builder
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 27 (Want to Send an HTML Email from Salesforce Flow? Oh, yes! It can be done!)
    • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
    • Getting Started with Salesforce Flow – Part 28 (Have a File Upload Component and Other Details on a Single Screen? Really? Wow!)
    • Learning Pardot
    • Learning Apex
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
  • Social Media

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