Wondering if there is a way to populate a drop-down dynamically from an external database? Extend the potential of your forms by using the response from a web service request to fill a drop-down list. Your form will adapt dynamically based on the returned data. In this article, we will see how to populate a drop-down list using web service. Let's get started!
Required user permissions to use this feature: this feature is only available to Admins and Marketeers, as it requires permission to create and/or edit forms.
Suppose you're creating a form that asks participants to select their favourite store. Your list of stores is constantly evolving: new stores are opening, others may be closing, moving or simply getting a rebranding and thus changing name. However, you don't want to have to come back to your form every week to double check whether it is up-to-date with the latest changes...
In this case, populating this list and automatically updating it via web service would be ideal.
Now suppose you’re creating a form that asks participants to enter their postal code, followed by their nearest car dealer. You would want the postal code selection to determine the list of dealers, or their display order.
So when a participant enters their postal code, the car dealer drop-down list is populated using a web service. In this scenario, the participant doesn't have to select a postal code to select a car dealer. But upon selection of a postal code, the car dealer list is set to display results in order of proximity, with the nearest car dealer as default value automatically selected. This is what we can call "field dependency": controlling a field's value based on another field.
How does that happen? A web service provides a list of values (in this example, car dealers) to be populated into the drop-down list as possible answers. So depending on the participant's selection, we search and get data from your database.
How to bind your database to the form
First of all, we need to be able to feed the drop-down list with dynamic data values from an external source. Commonly, Qualifio forms will call web services to build those lists.
Our technical team will first need to enable the integration one time for your whole account to use. Please make contact with your Qualifio Expert to discuss the possibilities around your specific use case.
Using the integration
To create a drop-down list that will be populated with results from your web service, go into any of your campaigns that contains a form (identified). Select the Form step.
If the drop-down you're looking to populate with values returned from your web service doesn't need controlling/input fields, you may skip this step and go directly to Step 3.
Create and/or attach the controlling/input field(s) you need.
In the example above, you'd need to create the Postal code field, since you'd want to display car dealers based on the postal code entered by the participant.
NOTE: It is possible to have several fields controlling the dependent/output field. For instance, you might want to display car dealers not only based on the postal code of the participant, but also on their address. In this case, you could have 3 controlling/input fields: postal code, street name and number.
Click Create and attach a new field, then choose Drop-down list as field type.
Enter your question text, then attach the required CRM or SSO variable (listed in the Options section) that your Qualifio Expert sent you. This will indicate us which request to send to your web service for this specific question.
Click the Advanced tab at the top of the screen, and select an option from the Populate based on web service menu.
When you're done, click the Save button.
Field types considerations
Consider the following when requesting the possibility to dynamically populate form fields using a web service:
- Drop-down lists can be controlling or dependent fields.
- Postal code fields can be controlling fields but not dependent fields.
- Alphanumeric and numeric fields can be controlling fields but not dependent fields.
- Other field types currently do not support to be populated from a web service list.
More attention points
- When you convert an existing field into one that will be automatically populated, it will affect the existing answers for that field. After conversion, existing answers (if any) are deactivated and hidden. However, they can be recovered if you disable the web service integration later on.
- You cannot set default values for a dependent drop-down list.
- This integration can also be managed at Master Form level.