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.
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).
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!
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).
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.
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.
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.
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!
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.
LikeLike
You would want to use a different Object. You’re looking to create (if you want to create a comment), FeedComment — https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_feedcomment.htm — note – ParentId = the FeedID of the post the person made.
Is that what you were aiming for?
LikeLike