Big Idea or Enduring Question:
How can we develop declarative functionality to add or remove followers from a record?
In Salesforce, a user can follow Chatter groups or Records. Salesforce provides out-of-the-box functionality so that Chatter group managers can also add/remove people from the group. To manage a record’s followers/subscribers, Salesforce does not have any pre-built functionality to add or remove a follower/subscriber from object records.
After reading this article, you will be able to:
- Use Flow to manually add or remove users as subscribers from a record
- Understand the component visibility option to create a highly dynamic screen
- Learn how to use a Decision element to find whether a Record variable or a Record collection variable, contains a record
- And, last but not the least, discover how to add a Flow to Lightning Record Page and display it to a set of users
Business Use Case
Elise Shelley, a Lead System Administrator at Universal Containers (UC) receives a requirement from his management, they want to develop an application for the user with the role of Direct Sales Director so that they can use it to add or remove followers/subscribers to Account records.
Automation Champion Approach (I-do):
First of all, I want to say thanks to Andrew Johnson for sharing his idea (7 years ago) and flow (Add follower to record), which he shared in the success community. In this blog, we will use Salesforce Flow to solve the above business requirement. My main aim is to show the various ways to use Salesforce Flow in your organization.
While this can be solved using various automation tools like Apex, etc, we will use Screen Flow.
Before proceeding ahead, you have to understand the EntitySubscription object. The object represents a user‘s subscription – whether the user follows a record or other users. A user can subscribe to a record or to another user.
|SubscriberId||The Id of the User who is following the record or user.|
|ParentId||The Id of the record or user which the user is following.|
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.