Use Form Data Model

data-integration

Experience Manager Forms data integration lets you use disparate backend data sources to create a Form Data Model that you can use as schema in various Adaptive Forms workflows. It requires configuring data sources and creating Form Data Model based on data model objects and services available in data sources. For more information, see the following:

A Form Data Model is an extension of JSON schema that you can use to:

Create Adaptive Forms and fragments

You can create Adaptive Forms and Adaptive Form Fragments based on a form data model. Do the following to use a Form Data Model when creating an Adaptive Form or Adaptive Form Fragment:

  1. In Form Model tab on Add Properties screen, select Form Data Model in the Select From drop-down list.

    create-af-1-1

  2. Tap to expand Select Form Data Model. All available form data models are listed.

    Select a from data model.

    create-af-2-1

  3. (Adaptive Form Fragments only) You can create an Adaptive Form Fragment based on only one data model object in a form data model. Expand Form Data Model Definitions drop-down. It lists all data model objects in the specified form data model. Select a data model object from the list.

    create-af-3

    Once the Adaptive Form or Adaptive Form Fragment based on a Form Data Model is created, Form Data Model objects appear in the Data Sources tab of the Content browser in Adaptive Form editor.

    NOTE

    For an Adaptive Form Fragment, only the data model object selected at the time of authoring and its associated data model objects appear in the Data Sources tab.

    data-model-objects-tab

    You can drag-drop data model objects onto the Adaptive Form or fragment to add form fields. The added form fields retain the metadata properties and binding with data model object properties. The binding ensures that the field values are updated in the corresponding data sources on form submission and prefilled when the form is rendered.

Preview with sample data

Form Data Model editor allows you to generate and edit sample data for data model objects in the form data model. You can use this data to preview and test Adaptive Forms. You must generate the sample data before previewing as described in Work with form data model.

To preview an Adaptive Form with sample data, open the Adaptive Form in author mode and tap Preview.

Prefill using Form Data Model service

Experience Manager Forms provides out-of-the-box Form Data Model Prefill Service that you can enable for Adaptive Forms based on form data model. The prefill service queries data sources for data model objects in the Adaptive Form and accordingly prefills data while rendering the form or the communication.

To enable the Form Data Model Prefill Service for an Adaptive Form, open the Adaptive Form Container properties and select Form Data Model Prefill service from the Prefill Service drop-down in the Basic accordion. Then, save the properties.

prefill-service

Write submitted Adaptive Form data into data sources

When a user submits a form based on a form data model, you can configure the form to write submitted data for a data model object to its data sources. To achieve this use case, Experience Manager Forms provide Form Data Model Submit Action, available out-of-the-box only for Adaptive Forms based on a form data model. It writes submitted data for a data model object in its data source.

To configure the Form Data Model Submit Action, open Adaptive Form Container properties and select Submit using Form Data Model from the Submit Action drop-down under the Submission accordion. Then, browse and select a data model object from the Name of the data model object to submit drop-down. Save the properties.

On form submission, data for the configured data model object is written to the respective data source.

You can also submit form attachments to a data source using binary data model object property. Do the following to submit attachments to a JDBC data source:

  1. Add a data model object that includes a binary property to the form data model.

  2. In the Adaptive Form, drag-drop the File Attachment component from the Components browser onto the Adaptive Form.

  3. Tap to select the added component and tap settings_icon to open the Properties browser for the component.

  4. In the Bind Reference field, tap foldersearch_18 and navigate to select the binary property you added in the form data model. Configure other properties, as appropriate.

    Tap check-button to save the properties. The attachment field is now bound to the binary property of the form data model.

  5. In the Submission section of the Adaptive Form Container properties, enable Submit Form Attachments. It submits the attachment in the binary property field to the data source on form submission.

Invoke services in Adaptive Forms using rules

In an Adaptive Form based on a form data model, you can create rules to invoke services configured in the form data model. The Invoke Services operation in a rule lists all available services in the Form Data Model and allows you to select input and output fields for the service. You can also use the Set Value rule type to invoke a Form Data Model service and set the value of a field to the output returned by the service.

For example, the following rule invokes a get service that takes Employee Id as input and the values returned are populated in the corresponding Dependent Id, Last Name, First Name, and Gender fields in the form.

invoke-service

In addition, you can use the guidelib.dataIntegrationUtils.executeOperation API to write a JavaScript in the code editor for the rule editor.

On this page