If you’ve used the Formstack/Salesforce File Attachment Object, you may have noticed that Attachments have required fields which can pose as a roadblock depending on how you are mapping your data.
For example, if you want file attachments to be optional. Or, you want to use Conditional Logic on your Form to conditionally send attachments to Salesforce. In those cases, we have a workaround recommendation!
Because the Salesforce Attachment Object has a set of Required fields, the Formstack integration will require input data with every submission when using the Attachment Object. This workaround will utilize a custom Salesforce URL Field on an Object to capture the Form Attachment. Those attachments are then accessible in Salesforce as clickable links. The benefit here is that Salesforce URL Fields will not be required and/or can be used with Conditional Logic, unlike a formal Attachment Object.
1. Adding Salesforce URL Fields
First, you will need to add a custom URL Field to the desired Object. For instance, if you want attachments to be listed under your Account Objects, you will need to add the custom URL field under Accounts.
To do this, log into your Salesforce Account > Setup > App Setup > Customize > click the Object in question (i.e. Accounts) > Fields > Account Custom Fields & Relationships > New.
Select “URL” as your Data Type field > Enter a Field Label > Follow the steps to complete the setup. If you’d like more than one attachment mapped to your Object, you can follow these steps to create a second, third, etc. field for collecting and mapping multiple attachments.
Important Tip: Once the Field has been saved to the Object in Salesforce, be sure the new URL field(s) have been added and saved to the Page Layout. If the fields are not listed on the Page Layout, Formstack will not be able to pull them in for Field Mapping.
2. Mapping Salesforce and Formstack
With the URL fields setup and saved to your Salesforce Page Layouts, you can go back to your Formstack integration settings to complete the mapping. If you already have your Object mapped, you will need to click the “Refresh” icon to the right of the Object in question. This will reload any new/updated fields and pull in the new URL fields for mapping. If you do not have the Object listed under your Form, you can add it now using the “Select Object” drop-down menu.
The URL fields will display in the Object like any other fields vs. being listed as a traditional Attachment Object. Map your Salesforce URL field to the Upload File field on your Formstack Form. If you have multiple URL fields, you can map these to the various attachment fields between the Form and Salesforce.
Alternatively, if you would like to map multiple Upload Fields from the Form to a single URL field in Salesforce, use the "Value" mapping method and click on the Form Field(s) titles to insert the Field merge codes for mapping. When the Form submits, those merge codes will be automatically replaced with the URL links for the attachment file(s).
3. Testing Your Form
At this point, you are done! When your Form is submitted, Users will be able to attach files that are required, optional and/or hidden by field logic. If an attachment is included by the submitter, it will be sent to Salesforce as a URL; in Salesforce, you can click on these URLs to view the attachment in your browser.
Optional Image View
As an optional and bonus step, you can include a Formula Field in Salesforce to convert your URL field to a placeholder image within the Object. This setting will give your Salesforce CRM Users a visual representation of the attachment.
To add this step, you’ll first want to add your custom URL field(s) to the Salesforce Object. Next, you need to add a custom Formula Field of the Text variety to your Salesforce Object. Using a Simple Formula, amend the code below, then copy and paste this into your Formula Field.
1. Copy/paste: HYPERLINK (
2. Using the Select Field Type and Insert Field drop downs, locate your URL Field in the Object and select it from the “Insert Merge Field” option to add the API Merge code. Example: File_Upload_Field__c
3. Follow your Merge code with: , IMAGE (“
4. Next, add the URL address for the static image that will represent attachment,ts. In this example, I am using/referencing a paper clip Font Awesome icon.
5. Close your Formula with: "File Upload"))
6. Full Formula:
HYPERLINK(File_Upload_Field__c, IMAGE("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Paper_clip_font_awesome.svg/50px-Paper_clip_font_awesome.svg.png", "File Upload"))
Once your Formula has been created, save this and confirm that you have added it to all necessary Page Layouts in Salesforce.
The Formula Field will be displayed in the Salesforce Object as a clickable image which takes you to the file supplied from a Form Submission. You do not need to map this Formula field to Formstack or reference it in the Formstack settings.