Auto follow new users

Posted on Updated on

Follow

In Salesforce Chatter is a great way to boost internal Collaboration. This is great because it allows your organization to keep all its data and information in one place. User can Post Status, link, File and comment on others post etc. Many time I found on success community people are asking about a way to Auto follow new user. The first solution that comes upon in our mind is to write an Apex Trigger,but do you know you can achieve the same functionality without using code i.e. by using Flow and Workflow Rule to fire/trigger our Flow. Few benefits of follow the new user is

1) Keep up with what new user are doing by following and you can able to guide them so they will get more out of it.
2) You can help them to improve their productivity by clearing their doubts, because after following you can track their Chatter activity.

Business Use case :- Higher management in Universal Container wants to develop an application for  their organization so that new users will auto follow by all System administrators.

Solution of above business requirement

To solve this requirement we will use Flow and Headless Flow. Before going ahead with the solution you have to understand about EntitySubscription Object. It’s Represents a subscription for a user following a record or another user. User can subscribe to a record or to another user.

Field Name Details
ParentId ID of the record or user which the user is following
SubscriberId ID of the User who is following the record or user

To develop this application follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you. Now create One Text type variable ParentID (To pass the new user ID ),

Variable to store new User ID
Variable to store new User ID

3) Drag and drop a Fast Lookup ( Give the name System Administrators UserID) onto the window to get a list of users those having a system administrator profile and and map the fields according to below details

  • Select Object User
  • IsActive= TRUE
  • ProfileId=  00e90000001A75c [System Administrator profile ID], Save the records ID into Sobject Collection variable in our case it’s {!UsersID}, You can take help from the following screenshot
To get Users with profile system administrator
To get Users with profile system administrator

4) Drag and drop a Loop Logic (Give the name Extract user id one by one) on the window to extract value from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot

Loop to extract User ID one-by-one
Loop to extract User ID one-by-one

5) Drag and Drop Assignment Logic (Give the name Set follower detail) on the window, to assign SubscriberID and ParentID and into the Sobject variable (EntitySubscription Object Type) {!FollowerDetail} as shown in the below screenshot

Set Follower Details
Set Follower Details

6) Drag and Drop Assignment Logic (Give the name All Details into one Collection Variable) on the window and assign value from Sobject variable {!FollowerDetail} to Sobject Collection variable {!MassFollow} so at the end of the for loop (To avoid SOQL limit) we will use it inside the Fast Create for Auto follow new users. You can take help from the following screenshot

Bulkify your flow
Bulkify your flow

7) Our final task is to create records in EntitySubscription object, To do that drag and Drop Fast Create (Give the name Auto Follow New Users) on the window and map the field according to the below screenshot

Auto Follow New Users
Auto Follow New Users

8) Finally our Flow will look like the following screenshot

Auto Follow New Users

9) Save the flow with name Auto Follow New Users and close the canvas.

Create Workflow rule to fire our Flow

Our next task is to create a workflow on the User object on creation and every time it’s edited event. To create a workflow on the User object follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
2) Select object  User from the drop-down
3) Enter Name, for Evaluate criteria  select Created, For Rule Criteria select LastName != Null as shown in the following screenshot

Workflow Rule
Workflow Rule

4) Add one Immediate Workflow Actions i.e. New Flow Trigger, Select Flow (Auto Follow New Users) and set Variable (ParentID) value as shown in the following screenshot

New Flow Trigger Action
New Flow Trigger Action

5) Save the workflow and activate it.

Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production.

Reminder email to upload Chatter profile photo

Posted on Updated on

Upload Profile PhotoChatter is a powerful Collaboration tool for your organization, for both internal users and partners. Each user has a visible profile page containing his Chatter wall as well as information about the user, including an Image. The first thing to do in Chatter is upload a profile picture to help your colleagues put a face to a name. In Salesforce I have never found Out of the box solution to send a reminder email to users to upload Chatter profile photo. In this article we will develop an app by using Flow.

Business Use case :- People in Universal Container are using Chatter for internal collaboration. Management in Universal Container wants to develop an application, so it will automatically send an email notification (Once in a week) to users who doesn’t have a Chatter profile photo.

Solution of above business requirement

First of all create one custom object to save condition and we will use WFR in this object to trigger our Flow. In this demo I will create an object called as Reminder Notification. Create object and field as per the following  screenshot and grant access to the only system administrator

Custom object Reminder Notification
Custom object Reminder Notification

To solve this requirement we will use Visual Workflow. To develop this application follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you
3) Drag and drop a Fast Lookup ( Give the name User with No Profile Pic) onto the window to get a list of users with no profile photo and Save the records into Sobject Collection variable in our case it’s {!AllUsers}, You can take help from the following screenshot

To get Users without Chatter Profile photo
To get Users without Chatter Profile photo

4) Drag and drop a Loop Logic (Give the name Each user details) on the window and extract value from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot

Loop to extract User details one-by-one
Loop to extract User details one-by-one

5) Drag and Drop Assignment Logic (Give the name Pass Email Address into Text Variable) on the window and assign the value to Text variable {!UserEmailAddress} as shown in the below screenshot

To Store Email Address
To Store Email Address

6) The next task is to send email alert to do that Drag and Drop Send Email  (Give the name Upload Chatter Photo) on the window and fill the details as per your business requirement. You can take help from the following screenshot

Send Email - Static Action
Send Email – Static Action

7) Our final task is to clear/empty text variable {!UserEmailAddress}, to do that Drag and Drop Assignment Logic (Give the name Clear Text variable) on the window and map the field as shown in the below screenshot

Empty Text Variable
Empty Text Variable

8) Finally our Flow will look like the following screenshot

Reminder email to upload Chatter profile photo

9) Save the flow with name Send reminder email and close the canvas.

Create Workflow rule to fire our Flow

Our next task is to create a workflow on the Reminder_Notification__c object on creation and every time it’s edited event. To create a workflow on the Reminder_Notification__c object follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
2) Select object  Reminder Notification from the drop-down
3) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time dependent workflow), For Rule Criteria select Created By != Null as shown in the following screenshot

Workflow Rule1
Workflow Rule1

4) Now Add a time trigger to  to set True after 7 Days of record last modification date. To do this click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, I selected 7 Days after the Last Modified Date. Now add one field update action for time dependent workflow and set the Start to True. You can take help from the following screenshot

Time based action
Time based action

5) Save the workflow and activate it.
6) Create another workflow (i.e. workflow Rule2 ) on the same object to fire our Flow, set entry criteria of trigger is Start= True

Workflow Rule2
Workflow Rule2

7) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow ( Send reminder email)  as shown in the following screenshot

New Flow Trigger Action
New Flow Trigger Action

8) Add one Immediate Workflow Actions i.e. New Field Update and Set Start to False, so it will queue the record for the next time.
9) Save the workflow and activate it.

It’s time to test this feature

1) Now create one record in the object Reminder Notification to fire our workflow rule (Don’t select Start check-box), it will look similar to below screenshot

Dummy Record

 To check time dependent workflow queue Follow the path, Click on Name | Setup | Administration Setup | Monitoring | Time-Based Workflow and search the queue

Time-Based Workflow Queue
Time-Based Workflow Queue

Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production.

Add Topic to multiple records

Posted on Updated on

Topic to multiple records

In Spring’14 release Salesforce.com comes with a new feature called as Topics for Objects, So we can organize records by using topics same as Chatter. Topics helps to organize records in a better way and make search easier for you. It also increases records, post and comments visibility. For example, if you’re working on an Opportunity for an Account Universal Containers, you might want to add the hashtag topic #UC or #Universalcontainers in Opportunity record. Anyone can click on these topics to find out more information about Universalcontainers and see what people and groups are talking about Universalcontainers, you can also find all records tagged with topic Universalcontainers, as shown in the below screenshot

Topic for Objects
Topic for Objects

I have never found any apps or out of the box solution to add a Topic to multiple records. In this article we will develop an app for similar functionality without using code.

Business Use case :- People in Universal Container are using Topics to organize records. Management in Universal Container wants to develop an application so that their business users can add a topic to multiple records without navigating screen to screen. In this demo I will add Topic to all Opportunity records based on Their AccountID. For  example add topic Universalcontainer to all opportunity records those belongings to Account  “Universal Containers“.

Solution of above business requirement

To solve above business requirement we will use Visual Workflow and to fire this flow will use Custom Link. Before going ahead with the solution you have to understand about TopicAssignment and Topic Object.

TopicAssignment :- It represents the assignment of a topic to a specific feed item or record.
Topic :- It Represents a topic on a Chatter post or record.

To develop this application follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you
3) Drag and drop a Screen Element ( Give the name Enter Search Criteria and Topic Name) onto the window and add two fields with below below detail

Name Data Type Required Description
Enter Account ID Textbox Yes To get Opportunity records based on AcocuntID, You can change search criteria based on your business requirement
Enter Topic name Textbox Yes Topic name to Add into records

It will look like the below screenshot

To Get User's Input
To Get User’s Input

4) Drag and drop a Record Lookup ( Give the name To Get Topic ID) on the window, To get the topic ID based on Topic Name entered by the user in the previous steps. Under object select Topic, and map Name –> {!Enter_Topic_Name} (Screen Input element Topic Name), and store ID into Text variable {!TopicID} as shown in below screenshot

To Get Topic ID
To Get Topic ID

5) Now Drag and Drop Decision element (Give the name Check Topic existence) on the window to check whether Topic that user entered exist or not, to do that we will use variable {!TopicID}. If the variable {!TopicID} is null = False it means the Topic already exist. You can take help from the following screenshot

Check Topic Existence
Check Topic Existence

6) Next task it to Create the Topic in Salesforce if it’s not exist. Drag and drop a Record Create( Give the name Create Topic) onto the window and map the fields according to below details

  • Select Object Topic
  • Name{!Enter_Topic_Name} [ This is nothing but Topic Name that user entered in the first step], Save Id of records into any variable in our case it’s {!TopicID} variable, You can take help from the following screenshot
Create Topic
Create Topic

7) The next task is to get all Opportunities based on AccountID provided by the user. To do that Drag and drop a Fast Lookup ( Give the name Get Opportunity Records based on AccountID ) onto the window to get all Opportunity records and map the fields according to below details

  • Select Object Opportunity
  • AccountId{!Enter_Account_ID} [T his is nothing but AccountID that the user entered in the first step], Save Id of records into Sobject Collection variable in our case it’s {!AllOppIDs} . You can take help from the following screenshot
Get all Opportunity Records
Get all Opportunity Records

8) Drag and drop a Loop Logic (Give the name To get Single OppID) on the window and extract Opportunity details from Sobject Collection variable and pass it to Sobject variable, You can take help from the following screenshot

Loop to extract opportunity one-by-one
Loop to extract opportunity one-by-one

9) Our next task is to add OpportunityID and {!TopicID} details into a Sobject variable, so at the end we will add Topic to all Opportunity records. Drag and Drop Assignment Logic (Give the name Add One by One Detail) on the window and a assign value of  {!SingleOppID.Id} to Sobject variable variable {!AddDetailsInOneVariable.EntityId} and {!TopicID} to Sobject variable variable {!AddDetailsInOneVariable.TopicId}. You can take help from the following screenshot

Add Details into Sobject variable
Add Details into Sobject variable

10) Drag and Drop Assignment Logic (Give the name Add All Details into one Collection Variable) on the window and assign value from Sobject variable {!AddDetailsInOneVariable} to Sobject Collection variable {!AllinOne} so at the end of for loop (To avoid SOQL limit) it will add Topic to all Opportunity records. You can take help from the following screenshot

All in One
All in One

11) Finally drag and Drop Fast Create (Give the name AddTopicToRecords) on the window and map the field according to the below screenshot

Add Topic to multiple records
Add Topic to multiple records

12) Finally our Flow will look like the following screenshot

Add Topic to multiple records

13) Save the flow with name Add Topics To Multiple Records and close the canvas.

Add Visual workflow into the home page component

We can call Flow from custom button, link, sub-flow, Visualforce page , Apex start() or using Flow Trigger workflow action. Here we will call our flow from the homepage component. To do that follow below instruction

1) Create custom link from Name | Setup | App Setup | Customize | Home | Custom link

Custom Link
Custom Link

2) Add custom link in the Home page component
3) Add Home page component into the Home page layout

It’s time to test this feature

1) In this demo I will add a Topic Universalcontainer to all Opportunity records, those belong to Account Universal Containers
2) To open this app click on Add Topics To Multiple Records link available on the homepage, and fill the details you can take help from below screenshot

add-topics-to-multiple-records

3) Click on Next button and you are done. Below is the proof of concept

Outcome

Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production.

Merge Chatter Topics

Posted on Updated on

Merge

Topics are a great way to organize or increase post and comments visibility. For example, if you post that you’re working on a presentation for Dreamforce’14, you might want to add the hashtag topic #Dreamforce14 or #DF14 in your updates. Anyone can click on these topics to find out more information about Dreamforce’14 and see what people and groups are talking about Dreamforce’14. After Summer’14 Salesforce allows you to the delete topic from Salesforce User Interface,but not merge two different Chatter Topics.  I have never found any apps or out of the box solution to merge two different Chatter Topics. In this article we will develop same app without using code.

Business Use case :- People in Universal Container are using Chatter hashtag to organize their posts. Management in Universal Container wants to develop an application so that their system administrator can merge two different Topics (For example ABC & DEF).

Solution of above business requirement

To solve above business requirement we will use Visual Workflow and to fire this flow will use Custom Link. Before going ahead with the solution you have to understand about TopicAssignment Object. It represents the assignment of a topic to a specific feed item or record. Below are the key fields from TopicAssignment object

Field Name Details
EntityId Identifier of the feed item or record.
TopicId Identifier of the topic.

To develop this application follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you. Create Three variable

  • Topics (Sobject variable – TopicAssignment type )
  • GetAllPostFromTopics and NewTopicDetails (Sobject Collection Variable – TopicAssignment type)
Sobject Variables
Sobject Variables

3) Drag and drop a Screen Element ( Give the name Merge Topics) onto the window and add two fields with below below detail

Name Data Type Required
Old Topic ID Textbox Yes
New Topic ID Textbox Yes

It will look like the below screenshot

To Get User's Input
To Get User’s Input

4) Drag and drop a Fast Lookup ( Give the name Get all post from Old Topic ) onto the window to get all posts, links etc from old Chatter Topic and map the fields according to below details

  • Select Object TopicAssignment
  • TopicId{!OldTopicID} [OldTopicID is nothing but Screen Input field], Save Id of records into any variable in our case it’s {!GetAllPostFromTopics} Sobject Collection variable. You can take help from the following screenshot
Extract all Posts from old Topic
Extract all Posts from old Topic

5) Drag and drop a Record Delete ( Give the name Delete Old Topic) on the window. Under object select Topic, and map ID–> {!OldTopicID}, as shown in below screenshot

Delete Old Topic
Delete Old Topic

6) Drag and drop a Loop Logic (Give the name Extract post one by one) on the window and extract post from Sobject Collection variable and pass it to Sobject variable, as shown in the below screenshot

Loop Over TopicAssignement
Loop Over Topic Assignement

7) Drag and Drop Assignment Logic (Give the name Update Topic ID) on the window and a assign value of  Screen input {!NewTopicID} to Sobject variable variable {!Topic.TopicId} so that all posts from an Old Topic to assign New Topic. Take the help from the below screenshot

Update Topic ID
Update Topic ID

8) Drag and Drop Assignment Logic (Give the name Add all posts Into New Collection) on the window and assign value from Sobject variable {!Topic} to Sobject Collection variable {!NewTopicDetails} so at the end of for loop we will have all posts from Old Topic into One collection with updated Topic ID. Take the help from the below screenshot

All in One
All in One

9) Finally drag and Drop Fast Create (Give the name Record Create) on the window to add all posts from an Old Topic to New Topic,It means we are crating their reference in TopicAssignment object, as shown in the below screenshot

Move Posts from one Topic to another
Move Posts from one Topic to another

10) Finally our flow will look like the below screenshot

Merge Chatter Topics
Merge Chatter Topics

11) Save the flow with name (Merge Chatter Topic)  and close the canvas.

Add Visual workflow into the home page component

We can call Flow from custom button, link, sub-flow, Visualforce page , Apex start() or using Flow Trigger workflow action. Here we will call our flow using Custom Link available in the homepage component. To do that, follow below instruction:

1) Create custom link from Name | Setup | App Setup | Customize | Home | Custom link

Custom Link
Custom Link

2) Add custom link in the Home page component
3) Add Home page component into the Home page layout

It’s time to test this feature

1) In this demo I will  Merge Chatter Topic Dreamforce (Old) with Salesforce (New)
2) To get Topic ID ,for Topic Dreamforce take  a look of the below screenshot

How To Get Topic ID
How To Get Topic ID

3) To open this app click on “Merge Chatter Files” link available on the homepage, and fill the details you can take help from below screenshot

Open Merge Chatter Topic app
Open Merge Chatter Topic app

4) Now enter old and New Topic ID, In my case Dreamforce is Old Topic and Salesforce is New Topic and click on Next Button, as shown in the below screenshot

Merge Chatter Flow
Merge Chatter Flow

Your all Posts Including Status Update, links, polls or files are moved to new Topic.

Note :- I will suggest you to Implement this first on your developer org , test it and then move it to Production. Let me know if you have any difficulty to Implement it.

Various ways to setup email notification for Chatter Answers

Posted on Updated on

Email Notification for Chatter Question

Chatter Answers is a self-service and support community where users can post questions, receive answers and comments from other users or your support agents. Chatter Answers bring together Cases, Questions, Answers, and Knowledge article in a unified experience. In this article I will discuss various ways to setup email notifications for Chatter Answers. I am also going to discuss few business use cases and their solution.

1) Chatter Answers email notification Settings

Salesforce.com provides out of the box feature to setup email notifications for Chatter Answers, So System administrator can choose email notification options for their organization by following the path Name | Setup | App Setup | Customize | Chatter Answers | Email Notification Settings and possible options are
1) Replies to a question they own
2) Replies to a question they follow
3) Selects a best answer on a question they follow
4) Sends a private reply to their question (Customer Support)

Chatter Answers Email Notification Settings
Chatter Answers Email Notification Settings

But there are many business scenarios those are not falling under above category, I will discuss few here.

2) Question belongs to specific zones

Business Use case : – Universal Container is using Chatter Answer for their Internal support. They want to send an email alert to Public group (Product Experts) for all questions created in Zone = “Internal Issues“.

Solution of above business requirement

 To solve the above business requirement I will use Workflow Rule (on Question object) to send an Email alert. To create a workflow on the Question object follow the below instructions

a) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
b) Select an object  Question from the drop-down
c) Enter Name, for Evaluate criteria  select Created, In Rule Criteria select Question Body != Null and Zone = Internal Issues as shown in the following screenshot

Question belongs to Zone Internal Issues
Question belongs to Zone Internal Issues

d) Add one Immediate Workflow Actions i.e. New Email alert as shown in the following screenshot

Email Alert to Product Experts
Email Alert to Product Experts

e) Save the workflow and activate it.

Note :- If you want to send email alert for every Chatter question then include all Zones in workflow rule entry criteria like Zone !=  Null.

3) Question with no reply within time limit

Business Use case : – Universal Container has their internal team of experts to reply customer questions. They want to send an email alert to Public group (Product Manager) for question doesn’t have any reply after 5days of its creation.

Solution of above business requirement

The reply is basically the response to a question in an answers community. To solve the above business requirement I will use Time Based Workflow Rule (on Question object) to send an Email alert. To create a workflow on the Question object follow the below instructions

a) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
b) Select an object  Question from the drop-down
c) Enter Name, for Evaluate criteria  select Created, and any time it’s edited to subsequently meet criteria ( To create a time dependent workflow), In Rule Criteria select Number of Replies <= as shown in the following screenshot

Question with no reply
Question with no reply

e) Click on Add Time Trigger button and Set the length after how many days/hours workflow will fire  i.e.  in hours and days, In this case select 5hr after the Question: Created Date. Now add one Email alert action for the time dependent workflow to send email notification to Public group (Product Manager). You can take help from the following screenshot

Time based email alert
Time based email alert

e) Save the workflow and activate it.

4) Question Report Abuses above limit

Business Use case : – Universal Container wants to send an email alert to their System administrator (i.e. Rakesh Gupta) for questions which has more than 10 report abuse.

Solution of above business requirement

 Any users from the community can flag a question as SpamInappropriate or Hateful, as shown in the below screenshot

Flag question as Spam
Flag question as Spam

To solve the above business requirement I will use Workflow Rule (on Question object) to send an Email alert. To create a workflow on the Question object follow the below instructions

a) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
b) Select an object  Question from the drop-down
c) Enter Name, for Evaluate criteria  select Created, For Rule Criteria select Number of Report Abuses >= 10 as shown in the following screenshot

Question with more then 10 report abuse
Question with more then 10 report abuses

d) Add one Immediate Workflow Actions i.e. New Email alert as shown in the following screenshot

Email Alert to System Administrator
Email Alert to System Administrator

e) Save the workflow and activate it.

5) Reply Report Abuses above limit

Business Use case : – Universal Container product team closely watching customer activity on Chatter Answers. They wants to send an email alert to the System administrator (i.e Rakesh Gupta) for all replies which has more than 5 report abuse.

Solution of above business requirement

 To solve the above business requirement I will use Workflow Rule (on Reply object) to send an Email alert. To create a workflow on the Reply object follow the below instructions

a) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
b) Select object  Reply from the drop-down
c) Enter Name, for Evaluate criteria  select Created, For Rule Criteria select Number of Report Abuses >= 5 as shown in the following screenshot

Reply with more then 10 report abuse
Reply with more then 10 report abuses

d) Add one Immediate Workflow Actions i.e. New Email alert as shown in the following screenshot

Email Alert to System Administrator
Email Alert to System Administrator

Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production. Let me know if you have any difficulty to Implement it.

Auto follow Question after reply

Posted on Updated on

Reply

Chatter Answers is a self-service and support community where users can post questions, receive answers and comments from other users or your support agents. Chatter Answers bring together Cases, Questions, Answers, and Knowledge article in a unified experience. One major problem with Chatter Answers is it doesn’t have features like auto follow the question after reply. If you have any experience with Answers in Success Community so you know, Once you reply to any Question you will auto follow the Question. Benefits to follow a Question is you will get an email notification when there is a new reply to a question you follow ( If this feature is enabled for your Organization). System administrator can find this information for their organization by following the path Name | Setup | App Setup | Customize | Chatter Answers | Email Notification Settings for more information take a look of the below screenshot

Chatter Answers Email Notification Settings
Chatter Answers Email Notification Settings

In this article I will show you how you can develop the same kind of app for your organization without using the code.

Business Use case : – Universal Container is using Chatter Answer for their Internal support. They want to develop an app so that their user will auto follow Question after reply to them.

Solution of above business requirement

To solve this requirement we will use Visual Workflow and Workflow Rule (i.e Headless Flow).  Before going ahead with the solution you have to understand about QuestionSubscription and Reply Object. QuestionSubscription represents a subscription for a user following a Question and Reply represent a reply that a user has submitted to a question in an answers community. Below are the key fields of QuestionSubscription object

Field Name Details
QuestionId ID of the Question which the user is following.
SubscriberId ID of the User who is following the Question

To develop this application follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you. Create Three Text type variable UserID (To pass the User ID ),  QuestionID (To pass Question ID ) and SubscriptionStatus ( To Store the value)
3) Drag and drop a Record Lookup( Give the name Find User Subscription Status) onto the window to find users’ current subscription status and map the fields according to below details

  • Select Object QuestionSubscription
  • QuestionId{!QuestionID}
  • SubscriberId{!UserID}, Save Id of record into any variable in our case it’s {!SubscriptionStatus}. You can take help from the following screenshot
To get Users current Subscription Status
To get Users current Subscription Status

4) Now Drag and Drop Decision element (Give the name Subscription Status) on the window to check whether variable {!SubscriptionStatus} is null or not null. If the variable is Null = True it means user is not following the question, you can take help from the following screenshot

Decision Element
Decision Element

5) The next task is to Drag and drop a Record Create ( Give the name Follow Question) onto the window to follow the question and map the fields according to below details

  • Select Object QuestionSubscription
  • QuestionId{!QuestionID}
  • SubscriberId{!UserID}, you can take help from the following screenshot
Follow Question
Follow Question

6) Add one more element to bypass the else condition, It means if the user is already following the question. I added Assignment element
7) Finally our Flow will look like the following screenshot

 Auto follow Question after reply

8) Save the flow with name Auto follow Question after reply and close the canvas.

Create Workflow rule to fire our Flow

Our next task is to create a workflow on the Reply object on creation event. To create a workflow on the Reply object follow the below instructions

1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | New Rule
2) Select object  Reply from the drop-down
3) Enter Name, for Evaluate criteria  select Created, For Rule Criteria select Reply Body != Null as shown in the following screenshot

Workflow Rule on Reply Object
Workflow Rule on Reply Object

4) Add one Immediate Workflow Actions i.e. New Flow Trigger and Select Flow (Auto follow Question after reply) and set Variable (UserID and QuestionID) value as shown in the following screenshot

New Flow Trigger Action
New Flow Trigger Action

5) Save the workflow and activate it.

It’s time to test this feature

1) To test this app navigate to Q&A tab and find the Question to which you want to reply/answer, like the below screenshot

 Question

Right now follower count is 0.

 2) The next task is to reply/answer the Question, as soon as you done with reply refresh the page and check the follower count, Below is the Proof of concept for your reference

Reply to Question

Note :- I will suggest you to Implement this first on your developer org test it and then move it to Production. Let me know if you have any difficulty to Implement it.