Mapping your salesforce attachment / file to a link element

Last updated Apr 23 2018
Example #1: mapping your salesforce attachment and files to a link element

In this example we will ask the user to enter the last name of a contact in his Salesforce account and once it is done a link element will be populated based on it (it will be taken from the attachment under the contact object).
While this is example uses an attachment, the same thing may be done with Salesforce "Files" (in the Lightning version). The only small difference is that when you are using your file (instead of the attachment)  you will need to map it to the 'Version data' field in SF. (as opposed to mapping your attachment to the 'Body' field in SF).

When ready just Follow the yellow brick road:

* before you test this on your own account you will need to set up a test contact in your Salesforce account.  Please make sure it has a first name, last name and an image attachment under this contact.
1- Create a new form from blank
2-

Drag a Textbox element. From the: Elements panel > Basic > Input 


And change its label to ‘Contact last name’ in : Properties panel > Element > Settings > Basic > Label


3- 

Drag a Link element From the: Elements panel > Basic > Text

and when selected on canvas go to the elements properties and change the following:
Href URL - remove the default url - we will get it from SF.
Href text - Change the text to "My File" for example. In the integration we will set up we will have this text populated from SF as well.

4-

Now let’s start the SF integration 

Go to  Properties panel > Form> Settings > Salesforce Integration> Basic > Get From Salesforce and press on the ‘Map fields’ button.


5-

Set your integration:

- Authenticate with Salesforce


- Press on ‘Add object’ button

- Select the ‘contact’ object from the dropdown


- Set the following  condition: Last Name Equals Contact last name


- and make sure the option “First” in the ‘if multiple matches found take ID from’ radio button is selected. 

- Press on "Apply" 
- You will see that a new integration line has been added with the contact object.


Since our attachment in this example is located in a child object called “attachment” under  the ‘contact’ you will need to map it by adding a new sub-line below its parent (the second contact line) - as a child object.
- Press on the ‘+’ (Add child) button on the right side of the second integration line.


- Select the object ‘Attachment’.


- because this is a child object - a condition is already set automatically for you: 
Parent ID equals #2 Contact, Contact ID
- Make sure the option “First” in the ‘if multiple matches found take ID from’ radio button.


- and finally map the image:
fld3 URL  -- > Body
fld3 Text  -- > File Name

* in this example our image ID is fld3, but in your form the id number could be different.
Also - if you are attempting to populate from a SF "file" (in the Lightning version) instead of the 'attachment' you will need to map it to the 'Version data' field in SF. (as opposed to mapping your attachment to the 'Body' field in SF).
- Press on "Apply" and you will now see a child object line has been added to the one you had before in a hierarchical relationship.


- Press on "Apply" 
- You will now see that a new integration line has been added in hierarchy under the contact line you had.

- Press “Apply” and you will now see that there are 3 integration lines and that the attachment
Line was added with a hierarchical relationship.


- Press ‘Apply’ and save the form.
10- All you have to do now is publish your form as URL and test it.
Choose a Contact’s last name and its image and full name will be populated below.

6-

Save the form and test it
Publish it as URL
Enter a contact last name and you will see that the link text will change to the file name, and when pressed - the attachment will be downloaded.
   Learn more about Salesforce form builder
 
 
CommentsLogin Required
Didn’t find what you were looking for?
Try the following for assistance or Use the Search box.