File upload fields

Published on September 28th, 2010 | by Michael


How to send file uploads (attachments) to Salesforce

A common question we get regarding our Salesforce integration is if it’s possible to send file uploads (attachments) to Salesforce. This is possible by integrating with Salesforce’s “Attachment” object. Attachments can be linked to many other Salesforce objects: Account, Leads, Opportunities, and Contracts to name a few.

Here is how to set it up:

  1. Add a file upload field to your form. This goes without saying, if you want to send an attachment to Salesforce you need to have a file upload field on your form. For this example, I’ve added a File upload field on a form labeled “Attachment”:
  2. Add an “Attachment” object in your Salesforce integration.
  3. Link the Attachment to the appropriate Salesforce object. To do this, set the Parent ID to Link. A select list will populate of all the objects the Attachment can be linked to.
  4. Link the Attachment to the File Upload field on your form. To do this, set the File Name and Body to Field; then select the file upload field from the list of fields. At this point my integration settings look like this:
  5. Save Settings

That’s it! When your form is filled out and a file is uploaded. We will send the file to Salesforce. It will appear as an attachment to it’s linked object (set by Parent ID). Here is a Screenshot of the attachment in Salesforce after I submitted my test form:.


About the Author

Michael (@mmattax) is passionate about software development, which is why he is one of the lead developers of the Formstack application. Michael received his BS in Computer Science from Purdue University and has been professionally developing software since. Michael is a contributor and supporter of open source software and tools and has a commitment problem when it comes to Linux distributions. Outside of programming, Michael roots for the Colts on Sundays and wishes he could play eighteen holes of golf on all others.

8 Responses to How to send file uploads (attachments) to Salesforce

  1. Suresh Sankuratri says:

    Hi Michael. Thanks for the article. That was informative regarding attachments upload to Salesforce. I have a situation where i need to upload lots of attachments(few hundreds to thousands) from a legacy system to Salesforce. Could you advise how to go about it. Thanks

  2. Tim says:

    Michael –

    Thanks so much for posting this! The functionality is great!

    As a word to the wise, you will also need to set the “Save Data in the Database” parameter in the form to Yes. If this is set to No, the document will appear to save to Salesforce but it will be corrupted.

    Great work, FormStack!


  3. Chris says:

    Hi Michael,

    I found this blog post tremendously helpful!
    Sincerely want to thank you for posting the instructions.

  4. Pragati says:

    Hi Michael,

    Thanks for this wonderful blog.
    Could you please tell me how can I upload images in Salesforce through iphone ?
    Are Notes and Attachments or Document object supported by iphones/Salesforce Mobiles ?

  5. Emilee says:

    Is there a work-around for when the file upload field in formstack is optional, not required. If a user does not enter a file, they receive this error: “Salesforce error: Required fields are missing [name, body]

  6. Eva says:

    Hi Emilee,

    Thanks for reaching out. This is a good issue to report to our support team. You can contact them at Thank you for noticing this and letting us know!

  7. Hi Eva,

    I am also facing the similar issue of what Emilee is facing. While trying to upload attachment in the Salesforce we are getting required fields [Name,Body] missing error.
    The attachment section in the formstack is optional, so there may be an attachment or may not. Please advise.

    Is there any workaround for the same?

  8. Eva says:


    Our apologies for the delay in responding. Have you come to a resolution on this problem? In the future, contacting our support team will provide the fastest solution. They can be reached at

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Back to Top ↑