Last Updated on February 10, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
How do you ensure a user is notified about additional replies to a Chatter Question she answered?
With Chatter Questions, users can ask questions in their Chatter feed, in groups, and in records. Select Question from the Chatter publisher’s action menu, or click the Question tab. After a question is asked, moderators and the person who asked the question can select the best answer. The best answer is prominently displayed in the feed, allowing other users to quickly and easily find the information they need.
Your users can organize their information with the question title and details about their question. They can ask the question to their followers, to a group, or to a specific person, as they can with other Chatter feed items.
In the past, I have written a few articles on automating Questions and automation. Why not check them out while you are at it?!
Objectives:
After reading this article, you will be able to:
- Use Flow to identify if a user is already following a question
- If the user is not following the question, add the user as a follower
- Automatically trigger a Flow upon a question being answered
Business Use Case
Universal Containers is using Chatter Questions for their Internal support. When users answer questions, they don’t remember to go back and check for subsequent questions or feedback. Leadership has reminded everyone to follow the questions they answer, but people don’t usually remember. Therefore, Leadership has asked Steven Greene, a Lead System Administrator to come up with a solution so users are always added as followers to questions they answer.
Automation Champion Approach (I-do):
There are a few possible solutions for the above business scenario, but I’ll use After-save Record-Triggered Flow to solve the business requirement.
Check out this article to understand why we are using after-save record-triggered flow for this scenario.
Let’s take a pause here, familiar yourself with the QuestionSubscription Object in Salesforce. It represents a subscription for a user following a Question.
Field Name | Details |
QuestionId | The Id of the Question which the user is following. |
SubscriberId | The Id of the User who is following the Question |
Whereas Reply represents a reply that a user has submitted to a question in an answers community.
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 2 steps to solve Steven’s business requirement using Salesforce Flow. We must:
- Enable Replies to a Question they follow
- Salesforce flow
- Define flow properties for record-triggered flow
- Add a get records element to find the question subscriber detail
- Add a decision element to check if the record variable (from step 2.2) is null or not
- Add a create records element to add a user to question follower
Step 1: Enable Replies to a Question They Follow
If you have experience with Answers in the Trailblazer Community, you have used this functionality. And you also know, once you reply to a Question you will auto-follow it. The Benefit of following a Question is you will get an email notification about any replies. However, this feature must be enabled. To see if it is, follow the steps below:
- In Salesforce Classic, click Setup.
- In the Quick Find, type Email Notification Settings.
- Click on the Edit button.
- Select Replies to a question they follow checkbox.
- Click Save.
Step 2.1: Salesforce Flow – Define Flow Properties
As we have a requirement of creating a record in (CollaborationGroupRecord), this is why we have to use 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 and click on Next and configure the flow as follows:
- How do you want to start building: Freeform
- Trigger the Flow When: A record is created
- Run Flow: After the record is saved
- Object: Reply
- Condition Requirements: None
- Set Conditions: None
- Click Done.
Step 2.2: Salesforce Flow – Adding a Get Record Element to Find the Question Subscriber Detail
The next step is to use the QuestionSubscription object to check whether the current user (person who just replied to a question) is already following the Quetsion or not.
- Under Toolbox, select Element.
- Drag-and-drop Get Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Select the Record QuestionSubscription object from the dropdown list.
- Select All Conditions Are Met (AND).
- Set Filter Conditions
- Row 1:
- Field: QuestionId
- Operator: Equals
- Value: {!$Record.QuestionId}
- Add Condition
- Row 2:
- Field: SubscriberId
- Operator: Equals
- Value: {!$User.Id}
- Row 1:
- How Many Records to Store:
- select Only the first record
- How to Store Record Data:
- Choose the option to Automatically store all fields.
- Click Done.
Step 2.3: Salesforce Flow – Using Decision Element to Check the Record Variable (from step 2.2)
Now we will use the Decision element to check the Record Variable from step 2.2 to find if it returns the question follower status for the current user or not.
- Under Toolbox, select Element.
- Drag-and-drop Decision element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Under Outcome Details, enter the Label the API Name will auto-populate.
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- Row 1:
- Resource: {!Question_Follower}
- Operator: Is Null
- Value: {!$GlobalConstant.Flase}
- Row 1:
- Click Done.
Step 2.4: Salesforce Flow – Create Records – Add a User to Question Follower
To add a user to Question Follower drag and drop a Record Create onto the flow designer and map the fields according to the below details.
- Under Toolbox, select Elements. Drag and drop Create Records onto the canvas.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- Object: Question Subscription
- Set Field Values for the Entity Subscription
- Row 1:
- Field: QuestionId
- Operator: Equals
- Value: {!$Record.QuestionId}
- Add Field
- Row 2:
- Field: SubscriberId
- Operator: Equals
- Value: {!$User.Id}
- Click Done.
In the end, Steven’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- Type: Record-Triggered Flow
- API Version for Running the Flow: 51
- Interview Label: Auto follow a question after reply {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
Now onwards if a user replies to a Question, Salesforce Flow will automatically add them as a question follower.
- Navigate to the Q&A tab and find the Question to which you want to reply/answer.
- Right now the follower count is 0.
- Now reply to a question, as soon as you are done with the reply refresh the page and check the follower count.
- The follower count is now at 1.
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.
Hi Rakesh,
I could not find chatter questions in the Quick settings ..As per documentation I need to have question on the publisher layout and it is on that layout.what else needs to be done to see Questions and reply object.?
Hi Rakesh
Thanks for your articles. They’re quite helpful.
About this particular excerise, I can’t find the Reply Object. Do you have to first enable any settings in order to get that? Also I have tried following your steps but I can’t see the “Email Notification Settings” even after typing it in the Quick Find.
looking forward to your feedback.
Make sure that Chatter Questions has enabled in your org.
Thanks for sharing the tips. I am using this to make others understand.
Hi Rakesh,
Is this possible on the Chatter post? I’m trying to do this on the FeedItem object.
Thanks
You mean adding a Bookmark to Chatter post after comment? Could you please elaborate?
Can you make this work using Process Builder?
As per my understanding, No
I really like your writing style, good information, thankyou for posting. John
Thanks Rakesh. I was looking for it