How to Post to Chatter in Visual Flow

Some people might think, “Why would I want to Post to Chatter in Visual Flow when I can do that in Process Builder’s nice Chatter Post UI?”.  Well, the answer is pretty simple.  You’re only able to post to records related to the one that triggered your Process Builder to fire.  By doing our Chatter Post in Visual Flow, we are now able to @mention any User and any Record in Salesforce (that we have chatter enabled on).

Disclaimer: You are able to use a Record Create on the FeedItem Object to create a Chatter Post.  This is often times the route you’ll want to go, as there are more features that you can take advantage of that this Post to Chatter Static Action doesn’t have.  However, this Post to Chatter does not count against any of your Flow Limits (besides the 2,000 used element limit).  So, if you’re in a situation where your close to your limits, try using this action!

Depending on how many Flows, Quick Actions, and Email Alerts you have in your Salesforce, you might not notice the Static Actions section at the bottom of your Palette.  In here you’ll find a list of all three Static Actions.  We are going to be using Post to Chatter.

Great, we found our Post to Chatter, so lets drag it onto our Flow’s Canvas.

Drag Post to Chatter.jpg

Now, this is the cool part of a Static Action Post to Chatter is the same as an Email Alert.  I only need the Record ID for me to make the post, it doesn’t matter where or how I triggered this Flow!  It is important to note that this isn’t the only use for our Post to Chatter‘s Target Name or ID.  We have the option to post to a specific User or Group (just like we can in Process Builder).

TargetNameOrID

Note: If you insert the Username or Chatter Group’s Name into the Target Name or ID reference, you will need to include the Target Type to let Salesforce know whether they need to match that to a User or Group.  This could potentially save you a query if you’re close to your limits and you don’t already have that ID in your Flow.

Now, the next piece we get to is the Message.  This is the body or description of our Chatter Post.  I am going to strongly suggest that you always use a Text Template when doing anything with words in Flow.  So, that is exactly what we are going to do here to build out our Chatter Post!

Post to Chatter Text Template

If you notice, we have a different way of @mentioning Users or Groups inside of a Flow’s Chatter Message.  We must stick to the format of @ [ {User/Group ID} ] for our @mention to work properly.  DO NOT use the formatted text option, as you’ll see the actual HTML code show up in your Message.  The formatted text should only be used with Screens (places the User interacts with in your Flow).

Post to Chatter Finished Text Template

The great thing about using the Text Templates is that we can easily reference our Variables using the section that says Select resource.  This can come in handy when you want to bring in other related fields like the Opportunity Amount or Close Date into your Message.  You can either type the variable or other resource into the search box, or click on the dropdown arrow to have every listed by resource.

Selecting Resource.jpg

 

You also have the ability to add in additional parameters to your Post to Chatter.

  • Community ID
    • Only valid if you are posting to a User or Chatter Group that belongs to a Salesforce Community
    • ID of the Community you are referencing
  • Target Type
    • Required only if you are using the Username or Chatter Group Name in the Target Name or ID parameter
    • Valid Values
      • User
      • Group
  • Visibility
    • Only matter if you have a Salesforce Community enabled
    • Valid Values
      • allUsers
      • internalUsers

Notice what is not there – the ability to do it as a specific User.  This will always be written from the User who triggered the Flow.

Additional Chatter Options

On the Outputs side of our Post to Chatter we can see that we have the option to grab our Feed Item ID (the ID of the Chatter Post we create with this element).  Now, this can be great if you want to add comments or reference it elsewhere.  95% of the time, you’ll probably be ignoring this feature.

Setting FeedItem Id

Now all that is left is to press OK and map this Post to Chatter to the part of your Flow you need it to send from.  Pretty simple and easy to use!

 

2 thoughts on “How to Post to Chatter in Visual Flow

  1. Mayur January 25, 2017 / 7:55 pm

    I have similar scenario where for same record if someone Post again then it should be updated as comment for same Feed instead of creating a new Feed. I am capturing the FeedID in new variable and updating it in field created in record. Then in flow i am checking if feed id is not null than perform the action “Post to chatter” and providing TargetId as Feed ID.

    But i am getting error as – Verify the combination of your “Target Name Or ID” and “Target Type” fields to make sure you provide a valid user, Chatter group, or record to post to.

    Is there anyway through which i can update it to same Feed as a comment.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s