In this example we will ask the user to select a contact from a dropdown and once chosen its full name and image (taken from the attachment under the contact object) will be populated from the Salesforce account.
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 and 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 Dropdown element. From the: Elements panel > Basic > Multiple Input > Dropdown |
3- |
While the element is still selected delete the default options of the dropdown (first choice, second choice and third choice). Also turn off the “Add other” checkbox |
4- |
Now let’s start the SF integration in steps and map this dropdown to the contact ‘last name’ field in the SF contact object. 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 and turn on the ‘’Execute on form load’ checkbox (This will populate the contact names in to the dropdown when the form loads). - choose the option “All” in the ‘if multiple matches found take ID from’ radio button. And limit the number of items to 300. - all that’s left is to map the last name field in SF to your Contacts dropdown in the form. - You will see that a new integration line has been added with the contact object. |
6- |
You can check the integration up to now by publishing the form. You will see that once the form is loading a green progress will appear and then your dropdown will be populated with the contacts from SF |
7- |
Drag a section From the: Elements panel > Basic > Section In this example we will populate these 2 fields from SF based on the contact name chosen from the dropdown. When you drag an image onto the canvas it automatically opens a window to choose an image from our gallery or upload your own. However, since we would like to populate this image from Salesforce we will need to skip this and keep the image un-configured (so just close the window). |
8- |
Let's go back to the Get integration and set the mapping for the 2 added elements. |
9- |
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’. - Since 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: fld4URL -- > Body * in this example our image id is fld4, but in your form the 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 “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. |
Find out more about how to Integrate forms with Salesforce |