Create interactive communications

You can create an interactive communication based on a form data model that you can use to prefill interactive communication with data from configured data sources. In addition, the building blocks of an interactive communication, such as text, list, and condition document fragments can be based on a form data model.

You can choose a form data model when creating an interactive communication or a document fragment. The following image shows the General tab of the Create Interactive Communication dialog.

create-ic

General tab of Create Interactive Communication dialog

For more information, see:

Create an interactive communication

Text in Interactive Communications

Conditions in Interactive Communications

List fragments

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 interactive communications and adaptive forms. You must generate the sample data before previewing as described in Work with form data model.

To preview an interactive communication with sample form data model data:

  1. On AEM author instance, navigate to Forms > Forms & Documents.
  2. Select an interactive communication and tap Preview in the toolbar to select Web Channel, Print Channel, or Both Channels to preview the interactive communication.
  3. In the Preview [channel] dialog, ensure that Test Data of Form Data Model is selected and tap Preview.

The interactive communication opens with prefilled sample data.

web-preview

Similarly, to preview an adaptive form with sample data, open the adaptive adaptive form in author mode and tap Preview.

Prefill using form data model service

AEM Forms provides out-of-the-box Form Data Model Prefill Service that you can enable for adaptive forms and interactive communications based on form data model. The prefill service queries data sources for data model objects in the adaptive form and interactive communication 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

To configure form data model prefill service in an interactive communication, you can select Form Data Model Prefill Service in the Prefill Service drop-down while creating it or later by modifying the properties.

edit-ic-props

Edit Properties dialog for an interactive communication

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, AEM 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.

data-submission

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. For API details, see API to invoke form data model service.

recommendation-more-help