Getting Started with Process Builder – Part 51 (Auto Invite Customers to a Chatter Group)

Getting Started with Process Builder – Part 51 (Auto Invite Customers to a Chatter Group)

Last Updated on December 2, 2020 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 Process Builder and Flow to auto-invite customers to a chatter group. 
  • 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 audiencesChatter 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. 

There are a few possible solutions for the above business scenario. We will use Process Builder and Flow to solve it.

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.

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 6 steps to solve Pamela’s business requirement using Process Builder and Flow. We must:

  1. Create a chatter group
  2. Find the chatter group Id
  3. Creating a custom label to store chatter group Id
  4. Grant Invite Customers To Chatter system permissions
  5. Lightning Flow Steps:
    1. Define flow properties for auto-launched flow
    2. Add a record variable to store contact record details 
    3. Add a create records element  – invite customers to a chatter group  
  6. Process Builder Steps:
    1. Define process properties
    2. Define evaluation criteria
    3. Define process criteria
    4. Add action – flows 

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: Find the Chatter Group Id for Universal Container Customers 

The next step is to find out the Id of the chatter group UC Internal Announcements. One possible workaround is to use the Developer Console. 

  1. Click Setup | Developer Console 
  2. In the Query Editor, run the following SOQL query 
    1. Select id, name from collaborationgroup where (name=’Universal Container Customers’)
  3. Make sure to copy the Id. 

Step 3: Creating a Custom Label to Store Chatter Group Id

  1. Click Setup.
  2. In the User Interface, type Custom Labels.
  3. Click on the New Custom Label button.
  4. Enter Short Description the Name will auto-populate. 
  5. Now enter the Universal Containers Customers chatter group id in the Value.
  6. Click Save.

Step 4: 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 5.1: Lightning 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 Autolaunched Flow (No Trigger) option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
  5. Click Done.

Step 5.2: Lightning Flow – Add a Record Variable to Store Contact Record Data

  1. Under Toolbox, select Manager, then click New Resource to store User Id.
  2. Input the following information: 
    1. Resource Type: Variable
    2. API Name: varRContact
    3. Data Type: Record
    4. Object Contact
    5. Check Available for Input
    6. Check Available for Output
  3. Click Done.

Step 5.3: Lightning 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. 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 separate resources, and literal values
    4. Object: Customer Invitation
    5. Set Field Values for the Customer Invitation
    6. Row 1:
      1. Field: InvitedUserEmail
      2. Value: {!varRContact.Email}
    7. Click Add Row
    8. Row 2:
      1. Field: SharedEntityId
      2. Value: {!$Label.Universal_Containers_Customers}
  3. 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: 50
  5. Interview Label: Invite Customers to Chatter {!$Flow.CurrentDateTime}
  6. Click Save

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

Our next task is to create a Process on the Contact object to Launch a Flow, only when a contact is created. To create a Process on the Contact object, follow the instructions below:

Step 6.1: Define Process Properties

  1. Click Setup.
  2. In the Quick Find box, type Process Builder.
  3. Select Process Builder, then click New.
  4. Name the Process and click the Tab button. The API Name will populate. 
  5. As a best practice, always input a description
  6. The process starts when A record changes.
  7. Click Save.

Step 6.2: Define Evaluation Criteria

  1. Click on the Add Object node to begin selecting the evaluation criteria.
  2. Select the Contact object from the dropdown list.
  3. Start the process only when a record is created.
  4. Click Save.

Step 6.3: Define Process Criteria

  1. Click the Add Criteria node to begin defining the process criteria.
  2. Name the criteria.
  3. The criteria should execute actions when the conditions are met.
  4. Set Conditions
    1. Row 1
      1. Field: Contact | Email
      2. Operator: Is null
      3. Type: Boolean
      4. Value: False
  5. Select All of the conditions are met (AND)
  6. Click Save.

Step 6.4: Add Action – Flows

  1. Below Immediate Actions, click Add Action.
  2. For Action Type, select Flows
  3. Name the action.
  4. Select the flow we just createdInvite Customers to Chatter.
  5. Set Flow Variables: 
    1. Row 1:
      1. Flow Variable: varRContact
      2. Type: Field Reference
      3. Value: Select the Contact record that started your process
  6. Click Save.

In the end, Warren’s Process will look like the following screenshot:

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 process will fire and auto sends the chatter group invitation to them. 

  1. Currently, I logged-In as 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?

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!

Leave a Reply

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