Use Case: Create a Chatter Post in Salesforce and Include a File 

In this Article
Related Articles


Does your organization use Chatter?  You can use FormAssembly to post directly to any Chatter feed.

You can even include a file, so your organization can view the file right in Chatter!

Creating a FeedItem

Chatter posts are named FeedItem in the Salesforce API. If Chatter is enabled for your Salesforce org, you’ll see the FeedItem object listed in the Salesforce Connector setup page when adding a new step:

You can create and attach a Chatter post to any Salesforce record (for example, Contact, Case, or Opportunity).

A FeedItem object requires a Parent ID and some content, which can come from data submitted through the form, or which you can define with a formula or text in the connector mapping.  

The parent ID can also come from the ID of a previous step in your connector.  

Regardless of your mappings, begin this setup by creating a new FeedItem record:

Adding a File

If you’d like the Chatter post to include a file, you’ll need two extra steps: uploading the file to Salesforce and then associating it to the post.

To upload the file, you’ll create a ContentVersion record:

There are a few things to note here:

  1. ContentDocument ID shows as a required field — do not map anything to it. Salesforce will do that for you when you create the ContentVersion.
  2. Content Origin is set to “H”, relating it to Chatter
  3. Content Location is set to “S”, meaning that the file is natively in Salesforce.
  4. The First Publish Location ID is set to a User record — this can be changed to any other object except the FeedItem.  We'll elaborate on that more below.
  5. Version Data and Path on Client are both mapped to the actual file upload field in your form.

Associating the File with the Chatter Post

Now that we have the file being sent to Salesforce, we’ll associate it to the Chatter post we created above.

This is done with a FeedAttachment junction object:

There are a few steps to map here:

  1. The Feed Attachment Type should be mapped as “Content”
  2. The Feed Entity ID should get its value from the ID of the FeedItem you created above.
  3. The Attachment Record ID should get its value from the ID of the ContentVersion you created above.

Once you have these mappings complete, your Chatter posts can be associated with any record in Salesforce. For instance, they can show in a Lead’s Chatter feed, like below:

Finally, you can find out more information about our general integration with Salesforce Files here.

Terms of Service · Privacy Policy