Getting Started with Process Builder – Part 47 (@Mention a Related User In a Post to Chatter Action)

Getting Started with Process Builder – Part 47 (@Mention a Related User In a Post to Chatter Action)

Last Updated on November 22, 2020 by Rakesh Gupta

Big Idea or Enduring Question:

How do you @mentioned related users in a Post to Chatter process builder action? 

Objectives:

This blog post will help us to understand the following

  • How to use the post to chatter action in Process Builder
  • How to @mention the related user in a chatter post 

Business Use case

Pamela Kline is working as a System administrator at Universal Containers (UC). She has received a requirement to post Opportunity details to the UC Internal Announcement Chatter group whenever an Opportunity gets created or updated with an amount greater than 100,000 and also mention related user Opportunity Owner in the post.

Automation Champion Approach (I-do):

In Salesforce Chatter Group represent a group of people. It’s a great way to boost collaboration in your organization. You can add unlimited members into Chatter Group, but a user can join a maximum of 100 Groups. In this article Getting Started with Process Builder – Part 13 (Post to Chatter), I had discussed whenever an event is created for the public calendar post its detail to a Chatter Group using the Process Builder. This article goes a step ahead and explains, how to @mention a related user in a Post to Chatter action using the Process Builder. 

While this can be solved using various automation tools like Apex or Flow, we will use Process Builder. This is not something that can be accomplished with Workflow Rules. 

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 5 steps to solve Pamela’s business requirement using Process Builder. We must: 

  1. Create a Chatter Group
  2. Define process properties
  3. Define evaluation criteria
  4. Define process criteria 
  5. Add action – post to chatter

Step 1: Create a Chatter Group

  1. Navigate to App Launcher and click on the Groups.
  2. Clicks on the New button. 
  3. Name the Group and make sure to select the Private Access Type.
  4. Click Save.

Step 2: 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: Define Evaluation Criteria

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


Step 4: 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: Opportunity | Amount
      2. Operator: Greater than
      3. Type: Currency
      4. Value: 100,000
  5. Select All of the conditions are met (AND)
  6. Click Advanced
  7. Select Yes to execute the actions only when specified changes are made to the record.
  8. Click Save.

The reason why we would select the Yes checkbox for the question — Do you want to execute the actions only when specified changes are made to the record? — is to allow the Process Builder to execute the actions only if the record meets the criteria now, but the values that the record had immediately before it was saved didn’t meet criteria. This means that these actions won’t be executed when irrelevant changes are made.

Step 5: Add Action – Post to Chatter

To mention a user, related user, or chatter group, enter @[reference], where reference is the ID for the user or group that you want to mention. The reference can be a literal value, a merge field, or a flow resource. For example: @[{!UserId}]. In our case, it will look like @[{![Opportunity].OwnerId}]

  1. Below Immediate Actions, click Add Action.
  2. For Action Type, select Post to Chatter
  3. Name the action.
  4. Post to: Chatter Group
  5. Group: UC International Announcement
  6. Message:  
    1. An opportunity is created with an amount  {![Opportunity].Amount}. 
    2. cc  @[{![Opportunity].OwnerId}]
  7. Click Save.

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

Note:- Before you activate your process, you will want to make sure that you have assigned data in the correct format because Process Builder obeys validation rules. If some fields are required by using validation rules, then make sure you have added those fields. Conversely, if some fields are required on the page layout, you can ignore those fields.

Proof of Concept

Now onwards, if a business user updates the opportunity which has an amount greater than 100,000, then Process Builder will automatically trigger and create a post in chatter group UC Internal Announcement.

  1. Currently, Deer Valley Corp opportunity amount value is 1000, as shown in the following screenshot:
  2. Let’s update the amount to 110,000, then navigate to the Chatter group UC Internal Announcement and check out the Chatter group wall for the automated post:

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!

5 thoughts on “Getting Started with Process Builder – Part 47 (@Mention a Related User In a Post to Chatter Action)

  1. Is there a way to control the header of the chatter post? In some automated posts, the header is “‘User name’ added a file” whereas in your example it seems to be auto generated – ‘UC Internal Announcement – Rakesh Gupta”

  2. Is there a way to control the header of the chatter post? In some automated posts, the header is “‘User name’ added a file” whereas in your example it seems to be auto generated – ‘UC Internal Announcement – Rakesh Gupta”

Leave a Reply

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