Business and Enterprise plans
Data connections allow information to pass between a form and a third-party service, such as a database. They can be used to validate, retrieve, or lodge data.
The flow of information can be one-way (such as as lodging response data at the completion of a form) or two-way(for example, when using a database to populate predictive search results).
Types of data connections
We differentiate data connections by their position in a form. You can add them at the end of a form, or in the middle of a form.
|| How they work
Business and Enterprise plans
These data connections are usually (but not always) less complex one-way connections. Once a user has completed a form, an end-of-form connection can, for example:
These data connections are used to send and receive data prior to the completion of a form.
Mid-form connections are typically two-way, and used to validate or retrieve data from a third-party service. However, they can also be simple one-way connections, such as an analytics cue.
Mid-form connections can, for example:
Use information from a respondent’s entries to query a database and pre-fill other areas of a form
Validate respondent data (such as their address, if they are organizing waste collection)
Send analytics data to help understand form engagement (such as at what point respondents are dropping out of forms)
Return information to make a text field a predictive search
Create a data connection
Data connections use a standard JSON format to send and receive information. Before you set up a data connection, you might want to create a middleware application to translate information between OpenForms and your internal business systems.
Make sure your business systems have an API or some way for the middleware to connect to it. The middleware must also have a URL that OpenForms can send the JSON data to.
If you need more information about the JSON format, have a look at our examples.
You also need to make sure you’ve assigned external IDs to any fields you want to send or receive data from. To do this, open a form from My forms and select the gear icon next to a field. Open External ID and give it an ID. Fields can only have one ID.
Once you’ve done all this, create your data connection.
Only admins can create data connections in OpenForms. If you’re not an admin, you can still add an existing connection to a form.
From the main menu, go to Admin > Integrations > Data connections. This is where you can create and manage any connections.
Choose to either Import connections or manually Add connection, or click on an existing connection to manage it.
Fill in all the necessary information. If you enter more than one external ID, separate them with commas.
If your data connection is being used on a text field you can set it to act like a predictive search. Put the text field’s external ID in both the send and receive areas of the connection.
Save your changes.
The data connection’s ready to use in your forms. You can always update it whenever you need to.
Add a data connection to a form
Add an end-of-form connection
Open a from from My forms and go to Settings > Data connections. Select which connections you want to trigger and save your form. The connection will be triggered when the user clicks Submit.
Add a mid-form connection
- Open a form from My forms.
- Choose a field you want to add the connection to, and select the gear icon to open its settings.
- Open the Advanced tab and choose the connection you want in the Data connections field.
After you've selected a connection it will show you the list of external IDs that it will be sending and receiving so you know which ones you need to apply within your form. You can only apply a single connection to a field, but you can apply more to a section.
The connection will be triggered when the user clicks Continue within the section you added it to.
If your data connection is being used to return values to pre-fill fields, it helps if you put those fields in a different section. It would be confusing if someone entered their name and email and triggered a connection to pre-fill a field that they'd already passed.
Congratulations, you’ve set up a data connection. If you’re stuck, it might help you to look at our code examples for setting up middleware.