Preview with sample data

Form Data Model editor lets you generate and edit sample data for data model objects in the form data model (FDM). 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 select 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 (FDM). 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 (FDM), 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 (FDM). It writes submitted data for a data model object in its data source.

To configure the Form Data Model Submit Action:

  1. Open the Content browser, and select the Guide Container component of your Adaptive Form.

  2. Click the Guide Container properties Guide properties icon. The Adaptive Form Container dialog box opens.

  3. Click the Submission tab.

  4. From the Submit Action drop-down list, select Submit using Form Data Model.

    Action configuration

  5. Specify the Data model to submit.

  6. Click Done

On form submission, data for the configured data model object is written to the respective data source. In addition, you can submit a form attachment using a Form Data Model (FDM) and a Document of Record (DoR) to the data source. For information about form data model (FDM), see AEM Forms Data Integration.

NOTE
AEM as a Cloud Service offers various out of the box submit actions for handling form submissions. You can learn more about these options in the Adaptive Form Submit Action article.

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 (FDM).

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

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

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

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

  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 (FDM), you can create rules to invoke services configured in the form data model (FDM). The Invoke Services operation in a rule lists all available services in the Form Data Model (FDM) and lets you 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.

Invoke a form data model (FDM) using custom functions

You can invoke a form data model from rule editor using custom functions. To invoke the form data model (FDM) add a form data model to the allowlist. To add a form data model to an allowtlist:

  1. Go to Experience Manager web console at https://server:host/system/console/configMgr.
  2. Locate Adaptive Form-Level Whitelisting of Form Data Model for Service Invocation - Configuration Factory.
  3. Click plus icon icon to add the configuration…
  4. Add Content path pattern to specify the location of your Adaptive Forms. By default, the value is /content/forms/af/(.*) which includes all the Adaptive Forms. You can also specify the path for a specific Adaptive Form.
  5. Add Form Data Model path pattern to specify the location of form data model (FDM). By default, the value is /content/dams/formsanddocuments-fdm/(.*) which includes all the Form Data Model (FDM). You can also specify the path for a specific Form Data Model (FDM).
  6. Save the settings.

The added configuration is saved under the Adaptive Form-Level Whitelisting of Form Data Model for Service Invocation - Configuration Factory option.

video poster
NOTE
To invoke a form data model (FDM) from the rule editor using custom functions through an AEM archetype project:
  1. Create a configuration file.
  2. Set properties of getContentPathPattern and getFormDataModelPathPattern.
  3. Deploy the project.

Experience Manager