Last Updated on October 31, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
- How to use record-triggered flow to automate common chatter group management works to improve productivity?
Objectives:
Chatter Group is one of the great ways to boost collaboration in your organization. A Chatter group represents a group of users – one can add unlimited members to a Chatter Group, but a user can join a maximum of 100 Groups.
Below are a few tasks related to Chatter group membership that can be automated to enhance productivity.
- Send email notifications to group owners or managers when someone joins a Chatter Group.
- Send email notifications to group owners or managers when someone leaves a Chatter Group.
- Auto-update new member’s email frequency for a Chatter Group.
- Promote a user to the Chatter group manager if they belong to a specific Role.
It is possible to manage these tasks with the help of Flow. Let us see how to start working smarter by tackling a business use case.
Business Use Case
Maria Coleman works as a System Administrator at Gurukul on Cloud (GoC). At GoC, they use Chatter extensively to collaborate internally. Maria has received three requirements from upper management:
- When someone joins the ‘GoC Awesome People’ Public Chatter group, set their email frequency to – Email on Each Post.
- Notify the group owner when someone joins the Group.
- When a user joins the GoC Awesome People Group and belongs to the ’Customer Support, International’ role, automatically promote them to the group manager.
Automation Champion Approach (I-do):
There are a few possible solutions for the above business scenario. We will use Record-Triggered Flow to solve the requirement.
Before we proceed further, let us understand the characteristics of CollaborationGroupMember – It represents a member of a Chatter group.
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 understanding it.
Let’s begin building this automation process.
Guided Practice (We-do):
There are 3 steps to solve Maria’s business requirement using Before-Save and After-Save Record-Triggered Flow. We must:
- Create a public group and chatter group
- Salesforce Flow Steps:
- Define Flow properties for before-save record-triggered flow
- Create a formula to promote the member to group manager
- Add an Assignment element to the group member fields
- Salesforce Flow Steps:
- Define Flow properties for After-save record-triggered flow
- Add a Text Template to construct the email body
- Add a core action send email to send out an email
Step 1: Create a Public Group and a Chatter Group
Step 2.1: Define Flow Properties (Before-Save Flow)
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows, then click on the New Flow.
- Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
- Object: CollaborationGroupMember
- Trigger the Flow When: A record is created
- Set Entry Criteria
- Condition Requirements: None
- Optimize the Flow For Fast Field Updates
- Click Done.
Step 2.2: Create a Formula to Promote the Member to Group Manager
- Under Toolbox, select Manager, then click New Resource to determine the member role based on their user role.
- Input the following information:
- ResourceType:Formula
- API Name: forT_MemberRole
- Data Type: Text
- Formula: If( {!$UserRole.DeveloperName}=”CustomerSupportInternational”, “Admin”, “Standard”)
- Click Done.
Step 2.3. Using Assignment Element to Update the Opportunity FIeld
The next step is updating the collaborationGroupMember fields with new values. We will use the Assignment element, as we are using the before-save flow.
- On Flow Designer, click on the +icon and select the Assignment element.
- Enter a name in the Label field; the API Name will auto-populate.
- Set Variable Value
- Row 1:
- Field: {!$Record.CollaborationRole}
- Operator: Equals
- Value: {!forT_MemberRole}
- Field: {!$Record.CollaborationRole}
- Click Add Assignment
- Row 2:
- Field: {!$Record.NotificationFrequency}
- Operator: Equals
- Value: P
- Field: {!$Record.NotificationFrequency}
- Row 1:
- Click Done.
In the end, Maria’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter the Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 56
- Interview Label: Group Member – Before Save Flow {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Step 3.1: Define Flow Properties (After-Save Flow)
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows, then click on the New Flow.
- Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
- Object: CollaborationGroupMember
- Trigger the Flow When: A record is created
- Set Entry Criteria
- Condition Requirements: None
- Optimize the Flow For Action and Related Records
- Click Done.
Step 3.2: Add a Text Template to Construct the Email Body
Now we’ll create an email template using the Text Template. The text template allows you to specify the multi-line messages. It also allows you to use HTML code.
- Under Toolbox, select Manager, then click New Resource to create a text template.
- Input the following information:
- Resource Type: Text Template
- API Name: textT_EmailBody
- Select View as Rich Text
- Body
- {!$User.FirstName}& ” ” &{!$User.LastName} joins GoC Awesome People Chatter Group.
- Click Done.
Step 3.3: Add Send Email Action to Notify Group Owner
Now we will use the Send Email static action to send an e-mail to the Chatter Group Owner.
- On Flow Designer, click on the +icon and select the Action element.
- Search and select Send Email from the dropdown menu
- Label the new action Notify Owner.
- Set Input Values
- Body: {!textT_EmailBody}
- Subject: Someone joins a Chatter Group
- Email Addresses (comma-separated): {!$Record.CollaborationGroup.Owner.Email}
- Rich-Text-Formatted Body: {!$GlobalConstant.True}
- Click Done.
In the end, Maria’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter the Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 56
- Interview Label: Group Member – After Save Flow {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
The next time a user joins a Chatter group, record-triggered flows will fire and (1) update email frequency; (2) trigger an email notification to the group owner; and (3), based on a user’s role, it will also update their Chatter group role.
- Login as an active user with the Role – Customer Support, International.
- Locate the GoC Awesome People group, and click Join Group.
- The user will now become a Manager and receive email notifications on Every Post.
- An auto-generated email is sent.
I hope you enjoyed and found value in this blog post about automating Chatter group membership-related tasks. Mastering these skills will enhance your productivity and propel you to try various permutations and combinations to incorporate automation into your day-to-day processes and procedures.
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.
Hello Rakesh,
Thanks for this awesome article,could you let me know that complete requirement can be accomplished via process builder means sending Email (incorporated via flow) can be done via process builder as well ?
Is there any specific reason we have used flows, could you guide me on this point ?
Thanks,
Ritu Ghosh
Because when you create an email alert on the Group member object it does not allows you to access Group Owner’s email.
Thanks Rakesh