The Swamps of Salesforce-Dagobah

Post to Chatter from Visual Workflow


One of the most marvelous aspects of Visual Workflow is the fact that you can hit any API-based object from it. If it’s listed here, you can generally read, create or delete from it (with a few exceptions on protected objects, of course). It’s a surprising amount of power, once you dive into it. Today we’ll look at one of those possibilities: making Chatter posts from Flow. If you’re hip on upcoming events, you’ll know that the Salesforce product team is working on adding a new regular workflow action to post to Chatter (SAFE HARBOR!), but until that day comes, welcome to your one-and-only method of Chatter automation.

Well, you could always code something in Apex. And I suppose you could find something on AppExchange. Ok, it’s not your ONLY solution but it’s a pretty damn good one.

The key to creating a Chatter post is using the object “FeedItem”. “FeedPost” sounds more applicable, but it’s actually counter-intuitive; FeedItem is a newer object that replaced FeedPost (I believe this was done to enable other types of posts, like polls and dashboard components).

You can use the Create Record element, and only a few fields are required for your post.

The field “Body” is absolutely necessary. I highly recommend making a Text Template in your Flow and calling it for your Body. If your post is super-short, though, you can just type in what you like.

ParentId is also necessary; this is the Salesforce ID of the record that this Chatter post should be on. You can make it a User ID to post it on their wall, but best practice is to place it on any object that has Chatter Feed turned on. (You may also see a field called RelatedRecordId; this is actually a field only used when attaching Content to a Chatter post!)

LinkUrl and Title are optional; they are used if you wish to post link in your Chatter post. You can type in both of these fields manually, and you can even merge in Flow variables by manually typing in {!variableName}, as shown above.

There are other fields, and some of them may seem necessary, like Type. However, these fields are set to contain default values, and almost always, those default values are what you will want to use, so really the above fields are all you need to worry about.

Other Considerations

There you have it! Chatter post automation from Flows! Easy peasy! Now, because there has not been nearly enough levity in this blog post… narwhals.