Use Form Data Model use-form-data-model
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 create-af
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:
-
In Form Model tab on Add Properties screen, select Form Data Model in the Select From drop-down list.
-
Select to expand Select Form Data Model. All available form data models are listed.
Select a from data model.
-
(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.
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 note 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. 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 preview-ic
Form Data Model editor lets you 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 select Preview.
Prefill using Form Data Model service prefill
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.
Write submitted Adaptive Form data into data sources write-af
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 the Content browser, and select the Guide Container component of your Adaptive Form.
-
Click the Guide Container properties icon. The Adaptive Form Container dialog box opens.
-
Click the Submission tab.
-
From the Submit Action drop-down list, select Submit using Form Data Model.
-
Specify the Data model to submit.
-
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 and a Document of Record (DoR) to the data source. For information about form data model, see AEM Forms Data Integration.
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:
-
Add a data model object that includes a binary property to the form data model.
-
In the Adaptive Form, drag-drop the File Attachment component from the Components browser onto the Adaptive Form.
-
Select to select the added component and select to open the Properties browser for the component.
-
In the Bind Reference field, select and navigate to select the binary property you added in the form data model. Configure other properties, as appropriate.
Select to save the properties. The attachment field is now bound to the binary property of the form data model.
-
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 invoke-services
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 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.
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 using custom functions invoke-form-data-model-using-custom-functions
You can invoke a form data model from rule editor using custom functions. To invoke the form data model add a form data model to the allowlist. To add a form data model to an allowtlist:
- Go to Experience Manager web console at
https://server:host/system/console/configMgr
. - Locate Adaptive Form-Level Whitelisting of Form Data Model for Service Invocation - Configuration Factory.
- Click icon to add the configuration…
- 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. - Add Form Data Model path pattern to specify the location of form data model. By default, the value is
/content/dams/formsanddocuments-fdm/(.*)
which includes all the Form Data Model. You can also specify the path for a specific Form Data Model. - Save the settings.
The added configuration is saved under the Adaptive Form-Level Whitelisting of Form Data Model for Service Invocation - Configuration Factory option.
- Create a configuration file.
- Set properties of getContentPathPattern and getFormDataModelPathPattern.
- Deploy the project.
Related Articles
- Send email
- Submit to SharePoint
- Submit using Form Data Model
- Submit to Azure Blob Storage
- Submit to REST endpoint
- Submit to OneDrive
- Invoke an AEM Workflow
- Submit to Power Automate
- Submit to Workfront Fusion
- Connect Adaptive Form to Salesforce application
- Connect an Adaptive Form to Microsoft® Dynamics OData