Getting Started with Process Builder – Part 20 (Add Chatter Followers to Record)

Getting Started with Process Builder – Part 20 (Add Chatter Followers to Record)

Last Updated on November 30, 2020 by Rakesh Gupta

Big Idea or Enduring Question:

  • How can I allow users to easily add others as followers of a record?
  • Can I incorporate it as part of a new/existing Process Builder?

A few months back, I had written an article Add/Remove follower to record with Visual Workflow to discuss a way through which we can add or remove Chatter followers to account record. As you all know Flow runs in user mode, which means the Flow we had developed will only work for System administrators or users with the Modify All Users permission. There are few business scenarios where the business wants some workaround so that Flow will work for all the users (Only for users who have edit access on Account). 


This blog post will help us to understand the following

  • Start a flow from a Process Builder
  • Add another user as a follower of a specific record

Business Use case

Brenda David is a System Administrator at Universal Containers (UC). She has received a requirement to develop an application that will allow users with edit access on the account object to add Chatter followers to record.

Automation Champion Approach (I-do):

There are a few possible solutions for the above business scenario. We will use Flow and Process Builder to solve the requirement. The advantage of using Flow with Process builder is you don’t have to assign the Flow User feature license to the users. 

Flow can be run in System mode, bypassing the running user’s permissions.  For instructions on how to accomplish this same use case with only Screen Flow, refer to this post: Getting Started with Process Builder – Part 21 (Running a Flow in System Mode)

Before proceeding, you should become familiar with the EntitySubscription object in Salesforce. It represents a subscription for a user following a record or another user. A user can subscribe to a record or to another user.

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

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

  1. Creating a custom lookup field on account to store a new follower
  2. Lightning Flow Steps:
    1. Define flow properties for auto-launched flow
    2. Add a record variable to store account record data
    3. Add a decision element to check Add_Follower__c in record variable is not null
    4. Add a create records element to add a user to record follower
  3. Process Builder Steps:
    1. Define process properties
    2. Define evaluation criteria
    3. Define process criteria
    4. Add action – flows 

Step 1: Creating a Custom Lookup FIeld on Account Object to Store New Follower

  1. Click Setup.
  2. In the Object Manager, type Account.
  3. Select Fields & Relationships, then click New.
  4. Select Lookup Relationship as Data Type, then click Next.
  5. Select User as Related To, then click Next.
  6. Enter Field Label and click the tab key, the Field Name will populate. 
  7. As a best practice, always input a description
  8. Set the Field-level Security for the profiles, make sure to set this field as Visible only. 
  9. Add this field to Page Layout.
  10. Click Save.

Step 2.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 2.2: Lightning Flow – Add a Record Variable to Store Account Record Data

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

Step 2.3: Lightning Flow – Using Decision Element to Check Add_Follower__c in Record variable is Not Null

Now we will use the Decision element to check the Add_Follower__c field in the Record Variable (varRAccountfrom step 2.2 is not null. 

  1. Under Toolbox, select Element
  2. Drag-and-drop Decision element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Under Outcome Details, enter the Label the API Name will auto-populate.
  5. Condition Requirements to Execute OutcomeAll Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!varRAccount.Add_Follower__c}
      2. Operator: Is Null 
      3. Value: {!$GlobalConstant.False}
  6. Click Done.

Step 2.4: Lightning Flow – Create Records – Add users to the Public Group

To add a new user to Record Follower drag and drop a Record Create onto the flow designer and map the fields according to the below details. 

  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: Entity Subscription
    5. Set Field Values for the Entity Subscription
    6. Row 1:
      1. Field: ParentId
      2. Value: {!varRAccount.Id}
    7. Click Add Field
    8. Row 2:
      1. Field: SubscriberId
      2. Value: {!varRAccount.Add_Follower__c}
  3. Click Done.

In the end, Brenda’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: Add Chatter follower to record {!$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 Account object to launch a Flow, only when the Add Follower field is changed.  

Step 3.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 3.2: Define Evaluation Criteria

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

Step 5.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: Account | Add_Follower__c
      2. Operator:  Is changed
      3. Type: Boolean
      4. Value: True
  5. Select All of the conditions are met (AND)
  6. Click Save.

Step 4.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 createdAdd Chatter follower to record.
  5. Set Flow Variables: 
    1. Row 1:
      1. Flow Variable: varRAccount
      2. Type: Field Reference
      3. Value: Select the Account record that started your process
  6. Click Save.

In the end, Brenda’s Process will look like the following screenshot: Almost there! Once everything looks good, click the Activate button. 

Proof of Concept

  1. Log in as Brenda David (Profile assigned: – Standard User, Flow User feature license is not assigned to this user  ).
  2. Navigate to an account record and populate the Add Follower field with Nushi Davoud
  3. Confirm the user has been added
    1. Log out as Brenda.
    2. Switch to Classic
    3. Navigate to the account and review the followers
  4. You are done.

Independent Practice (We-do):

Identify use cases where records on other objects might need to be shared in a more manual way and implement the sharing using the above solution.

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!

8 thoughts on “Getting Started with Process Builder – Part 20 (Add Chatter Followers to Record)

  1. This seems like it should work but I am getting an error when attempting to set the Add Follower field on the Account. It is preventing me from testing. Any recommendations?

    Flow Details
    Flow Name: Add_Chatter_Followers_To_Record
    Type: Workflow
    Version: 1
    Status: Active
    Flow Interview Details
    Interview Label: Add_Chatter_Followers_To_Record-1_InterviewLabel
    Current User: William Pxxxxx (005410000027fbB)
    Start time: 8/10/2017 3:27 PM
    Duration: 0 seconds
    How the Interview Started
    William Pxxxxx (005410000027fbB) started the flow interview.
    Some of this flow’s variables were set when the interview started.
    myVariable_old = 0014100000jM9lxAAC
    myVariable_current = 0014100000jM9lxAAC
    ASSIGNMENT: myVariable_waitStartTimeAssignment
    {!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
    {!myVariable_waitStartTimeVariable} = “8/10/2017 3:27 PM”

    1. 1) Use below articles to auto add the members of a public group as chatter followers



      2) Auto Remove Followers From Closed Opportunity :-

      P.S. :- Thank you, it’s the topic of my next article most likely

  2. Would it be possible to use a similar system to unfollow too? I used this way to auto-follow opportunities and it really works great. Now I was just wondering if I can also create the unfollower in the same way???

Leave a Reply

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