Auto Select Automatically follow records that I create Checkbox

Auto Select Automatically follow records that I create Checkbox

Last Updated on February 10, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

  • How can I auto-select Automatically follow records that I create checkbox for new users? 

Objectives:

After reading this blog, you’ll be able to: 

  • How you can follow a record on chatter 
  • Use Before-save Record-Triggered to update field(s)
  • Create an automation to update fields on the user object 

Business Use Case 

Brenda David is a System Administrator at Universal Containers (UC). She has received a requirement to develop automation that auto-select Automatically follow records that I create checkbox as soon as user record gets created. 

Automation Champion Approach (I-do):

In Chatter, you can follow the records and Chatter Groups. In this article, I will talk about how to follow the record and the automation around it. You can follow any record by navigating to a records detail page and clicking on the Follow button as shown below screenshot:

Follow Records

If you want to Automatically follow records that you create, to do that follow the below instruction

  • Click on My Settings | Chatter | My Feeds
  • Select Automatically follow records that I create checkbox, as shown in the following screenshot:

There are a few possible solutions for the above business scenario. However, our purpose, in this blog, is to learn Flow and its advanced/new features. Therefore, we will use Before-save Record-Triggered Flow to solve the above business requirement.

Before proceeding ahead, you have to understand the User object and some of its fields.  

Field Name Details
UserPreferencesEnableAutoSubForFeed When true, the user automatically subscribes to feeds for any objects that the user creates.

Before discussing it, 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 Brenda’s business requirement using Salesforce Flow. We must:

  1. Define flow properties for record-triggered flow
  2. Add an assignment element  – update UserPreferencesEnableAutoSubForFeed to true 

Step 1: 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 Record-Triggered Flow option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
    2. Trigger the Flow When: A record is created
    3. Run Flow: Before the record is saved
    4. Object: User
  5. Select Any Condition Is Met (OR)
  6. Set Conditions
    1. Row 1
      1. Field: User | IsActive
      2. Operator: Equals 
      3. Value: {!$GlobalConstant.True}
  7. Click Done.

Step 2: Using Assignment Element to Update UserPreferencesEnableAutoSubForFeed to True

The next step is to update the UserPreferencesEnableAutoSubForFeed field on the user object to true. We will use the Assignment element, as we are using before-save flow. 

  1. Under Toolbox, select Element
  2. Drag-and-drop Assignment element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Set Variable Values
    1. Row 1:
      1. Field: {!$Record.UserPreferencesEnableAutoSubForFeeds}
      2. Operator: Equals
      3. Value: {!$GlobalConstant.True}
  5. 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. Type: Record-Triggered Flow
  5. API Version for Running the Flow: 51
  6. Interview Label: Automatically follow records that I create{!$Flow.CurrentDateTime}
  7. Click Save

Almost there! Once everything looks good, click the Activate button.

Proof of Concept

Now onwards if a user is created, the Automatically follow records that I create checkbox will be automatically selected. 

  1. Navigate to Setup | Administration | Users | Users
  2. Create a New User and mark it as Active.
  3. Click Save.
  4. Now logged-In through new user James Smith’s account or use SOQL query to validate the UserPreferencesEnableAutoSubForFeed field. 

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!
Preferred Timing(required)

5 thoughts on “Auto Select Automatically follow records that I create Checkbox

Leave a Reply

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

Discover more from Automation Champion

Subscribe now to keep reading and get access to the full archive.

Continue reading