Auto Invite Customers to a Chatter Group

Auto Invite Customers to a Chatter Group

Last Updated on March 7, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

  • How can you automatically invite customers to a Chatter Group? 

Objectives:

This blog post will help us to understand the following

  • Create a Flow to auto-invite customers to a chatter group. 
  • Use get element to avoid hard code of Id
  • Understand how to use Flow to create records

Business Use Case

Pamela Kline is working as a System administrator at Universal Containers (UC). She has received a requirement from the management to auto invite new contacts to a Private Chatter Group Universal Container Customers.

Automation Champion Approach (I-do):

Salesforce gives you the ability to open Chatter access to external audiences. A chatter customer group represents a group of users (internal including customers). It’s a great way to collaborate with your customers and has all the posts and files contained in your Salesforce org. You can have multiple Chatter groups for customers based on business types, geography, or a single Chatter group to collaborate with your customers. Customers have limited Chatter access and can only see the groups they are invited to and interact with members of those groups. 

Let’s take a minute’s pause here and understand CollaborationInvitation objects in Salesforce. This object represents an invitation to join Chatter, either directly or through a group.

Field Name Details
InvitedUserEmail The email address for the user invited to join Chatter.
SharedEntityId The ID of the user or group associated with this invitation. To invite a customer, set SharedEntityId to the ID of the private CollaborationGroup with Allow Customers turned on.

To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let’s begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Pamela’s business requirement using Record-Triggered Flow. We must: 

  1. Create a chatter group
  2. Grant Invite Customers To Chatter system permissions
  3. Salesforce Flow Steps:
    1. Define flow properties for record-triggered flow
    2. Add a decision element to check if the email has value
    3. Add a Get Records element to find the chatter group Id
    4. Add a decision element to check if chatter group found or not 
    5. Add a Create Records element to invite customers to a chatter group  

Step 1: Create a Chatter Group

  1. Navigate to App Launcher and click on the Groups.
  2. Clicks on the New button
  3. Name the Group 
    1. Check the checkbox for Allow Customers 
    2. Select the Private for Access Type.
  4. Click Save.

Step 2: Grant Invite Customers To Chatter to Users 

Now grant Invite Customers To Chatter system permissions to users via profile & permission set.  System Permissions - Invite Customers to Chatter

Step 3.1: Salesforce Flow – Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, and click on Create and configure the flow as follows:
    1. Object: Contact
    2. Trigger the Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done.

Step 3.2: Salesforce Flow – Using Decision Element to Check if Email Has Value

Now we will use the Decision element to check if the email has value.

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.Email}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.False}
  5. When to Execute OutcomeOnly if the record that triggered the flow to run is updated to meet the condition requirements.
  6. Click Done.

Step 3.3: Salesforce Flow – Adding a Get Record Element to Find Chatter Group Details

The next step is to get the chatter group Id. Now follow the steps below:

  1. On Flow Designer, click on the + icon and select the Get Records element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Select the Collaboration Group object from the dropdown list.
  4. Select All Conditions Are Met (AND).
  5. Set Filter Conditions
    1. Row 1:
      1. Field: Name
      2. Operator: Equals
      3. Value: Universal Container Customers
  6. How Many Records to Store:
    1. select Only the first record
  7. How to Store Record Data:
    1. Choose the option to Automatically store all fields.
  8. Click Done.

Step 3.4: Salesforce Flow – Using Decision Element to Check if Chatter Group Exists or Not

Now we will use the Decision element to check if the chatter group exists or not. 
  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!Get_Chatter_Group}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.False}
  5. When to Execute OutcomeIf the condition requirements are met
  6. Click Done.

Step 3.5: Salesforce Flow – Add a Create Records Element to Invite Customers to a Chatter Group

 The next step is to invite customers to a chatter group, for this, we will use the Create Records element.

  1. On Flow Designer, click on the + icon and select the Create Records onto the canvas. 
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Input the following information:
    1. How Many Records to Create: One
    2. How to Set the Record Fields: Use separate resources, and literal values
    3. Object: Collaboration Invitation
    4. Set Field Values for the Customer Invitation
    5. Row 1:
      1. Field: InvitedUserEmail
      2. Value: {!$Record.Email}
    6. Click Add Field
    7. Row 2:
      1. Field: SharedEntityId
      2. Value: {!Get_Chatter_Group.Id}
  4. Click Done.

In the end, Pamela’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. API Version for Running the Flow: 54
  5. Interview Label: Invite Customers to Chatter {!$Flow.CurrentDateTime}
  6. Click Save

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

Proof of Concept

Now onwards if a contact is created and it has an email address populated, then the record-triggered flow will fire and auto sends the chatter group invitation to them. 

  1. Currently, I logged-In as a user Tushar Gupta’s (Profile:Sales Reps EMEA) account. Now create a new contact as shown in the following screenshot:
  2. Contact will receive an email from Salesforce to join the Chatter group.

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? Feel free to share in the comments below.  

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.