You can prefill repeating sections in your form using either the Salesforce Prefill Connector or the Salesforce Marketing Cloud Prefill Connector. This can be incredibly useful if you are performing a lookup that returns multiple values, and you would like data from all of them to prefill your form.
For example, if you perform a campaign member lookup through the Salesforce Prefill Connector, and 20 different campaign members are found, you can prefill as many fields as you would like from each of those records, and pull that information into repeatable sections in your form.
Before setting up this type of workflow, you should be familiar with prefilling through the Salesforce Prefill Connector or the Salesforce Marketing Cloud Prefill Connector. Once you are familiar with the basics of prefilling, you can follow the steps below to begin prefilling repeatable sections.
Step 1. Add a Repeatable Section to Your Form
In order to map to a repeatable section, you have to first create one in your form. Otherwise, the connector will not display the options you see discussed on this page.
You can add a repeatable section by dragging in a group or fieldset from the Add Content menu. Next, drag any fields into the section that you would like set as repeatable. Finally, select the section and click on Options > Repeatable Option and configure the details as needed.
Step 2. Configure Your Connector
Once you have created your repeatable section in your form, you're ready to begin configuring your connector. You can follow the standard instructions for the Salesforce Prefill Connector or the Salesforce Marketing Cloud Prefill Connector.
The main difference is when you configure your lookup. For Salesforce, under the option for If more than one record is found, you will be able to choose Repeat fields (if applicable).
Once you have that option selected, you will see a section below named Multiple Records Setting. This is where you will be able to select the specific repeatable section in your form that you would like to be prefilled.
The section of prefilled data will be sorted by the first field of your form that is in the the repeatable section. You may use a hidden field here.
Salesforce Marketing Cloud
For Salesforce Marketing Cloud, this will be similar, except at the bottom of each lookup, you will see the option for Multiple Records Settings. As with the Salesforce Connector, this is where you'll be able to choose which repeatable section in your form you would like to be prefilled.
The data sections are sorted by the first field, by creation date.
Step 3. Mapping Your Connector
After you have selected the repeatable section that you will map to, you will need to map your fields in the standard manner. Choose the fields from Salesforce or Salesforce Marketing Cloud that you would like to use to populate your FormAssembly form.
Once you have finished mapping the fields for your objects, you are ready to Save and begin testing!
When using this type of setup, there are two important things to keep in mind:
- As mentioned above, if you try to prefill multiple values to fields outside of a repeating section, they will appear as a long list of values without any form of separation.
- When only 1 record is found then no repeated fields will be created. In other words, only the first section will be filled in.