Reference your external community users in Chatter posts

Chatter posts are one of the efficient ways that Salesforce provides to collaborate. It simplifies the business by helping people to work together.

Chatter posts are one of the efficient ways that Salesforce provides to collaborate. It simplifies the business by helping people to work together. The posts can be posted manually or in an automated way too. We can post something as generic information from records or if we need to refer to a specific people or a group, we can mention them. Think about an automated chatter post that mentions specific people or group based on a specific condition or a business situation. Eventually that user mentioned will get immediate attention to proceed with that situation based on the direction that he got from that post.

Some possible ways to automate chatter posts are

  • A visual flow-based solution
  • A process from process builder
  • Apex and Chatter Rest API based callout
  • Apex Feed Item based customization
  • Apex and connectapi namespace

Each way has its own advantages and limits. A few of them:

Feed Item is one of the simplest ways to post to a chatter using apex, but we are not able to specifically mention or point out some user or a group.

We need to consider chatter rest API limits when it comes to a rest API based solution. On the other hand, connectapi namespace counts every write as one DML operation along with chatter rest API limits.

Using a process builder process, we can mention internal or external community user and create a post, but it will be available only to internal chatter feed item which is available to internal salesforce users. As a result, even a customer or partner community user is mentioned, they will not be able to see their posts and those posts will become meaningless.

The focus of this article is to provide a user friendly and configurable way to achieve a chatter post which is visible to external community users. A visual flow-based chatter post solution provides all the advantages collectively and it is configurable especially. So, let’s save these apex lines later something and jump into the configurable solution.

The Idea here is to use a process builder process that launches a flow where the chatter post action is defined for community.

Let’s assume we have an Invoice number text field on a custom object, and we need to post a chatter post to external community user (need to mention) whenever invoice number is updated, and that post should contain that updated invoice number. Now let’s align this business requirement with our flow-based solution. Create a new flow of type “Auto-launched”.

Create the following three variable resources in flow. Make sure you are creating variables in the following order.

“messageContent” variable decides the body of the content that we are going to post. It also can use the other variables defined if needed. In our case we can use invoice and userId variables defined above to mention invoice number and user in that post. Refer the below image when creating a text template variable.

From the available Elements in flow builder, drag “Action” element into the flow screen.

Click on the action element, from the pop up menu window, select (easy to search) “Post to Chatter” as core action.

Give a suitable action label, in our case we have given “Post Invoice”.

Now, let us start setting our flow input values, click the box with the label of “Message”. Message  defines the body of the chatter post content. Based on the below image, select the resources accordingly and click “Done”.

Click on Store Output Values, provide feedItemId output variable to that feed Item Id box. For now, it is not necessary to set this output value. If we decide to extend the functionality of the flow in future, it will be a valuable prospect.

Finally activate the flow. Refer the below image that includes variables and action elements.

Now it is time to start defining our process that launches the above flow. Create a new process builder process. Based on your preference select when your process starts. In our case I have selected whenever a record changes.

Select your object. Here I have selected a custom object that contains invoice field ( to pass userId and invoice number flow  variables); the object that we selected should be related to the object that contains invoice or userId field or the same object that contains those fields.

Provide your criteria, in our case I have checked if that invoice is updated (isChanged) and is not null, condition will become true.

Choose “Launch a Flow” as immediate action and provide flow input value parameters. Refer the below image of process builder of action.

Save the process and activate it.

It’s all set! how can we check the results?

Hope, you have already configured your community, so your community users can see the posts.

If not go to your community’s community builder and drag “Feed” standard component (from available components) to your community page and publish the community.

Then log in as a community user to your community, and check that feed for chatter post>. Now, look into the post, make sure the condition we defined in the process builder is met (in our case, we need to update the invoice number from salesforce internally). The following chatter post (image) is a result of an example that we derived so far from the beginning. From this post, can we identify the variables we defined for flow? Yes, they are here.

Things to verify:

  • Activate a flow before creating a process. The flow should be of type auto launched.
  • Feed tracking must be enabled on that object.
  • To mention a user properly, make sure you used this template correctly. That is @[{!userId}]
  • The user receives/mentioned in that chatter should have access to that object and the record should be shared in anyway.
  • We can get the communityId using the query select id, name from network. Remember based on each org, the network Id will vary.

Reference:

https://help.salesforce.com/articleView?id=flow_ref_elements_actions_chatter.htm&type=5

https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_distribute_system_process.htm

https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/intro_what_is_chatter_connect.htm

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.