Create Form Data Model create-form-data-model

Version
Article link
AEM 6.5
Click here
AEM as a Cloud Service
This article

Data integration

Experience Manager Forms data integration provides an intuitive user interface to create and work with form data models. A Form Data Model relies on data sources for exchange of data; however, you can create a Form Data Model with or without a data source. There are two approaches to create a from data model depending on whether you have configured data sources:

  • Using preconfigured data sources: If you have configured data sources as described in Configure data sources, you can select them while creating a form data model. It brings all data model objects, properties, and services from the selected data sources available for use in the form data model.

  • Without data sources: If you have not configured data sources for your form data model, you can still create it without data sources. You can use the Form Data Model to author Adaptive Forms and test them using sample data. When data sources are available, you can bind the Form Data Model with data sources, which automatically reflects in the associated Adaptive Forms.

NOTE
You must be a member of both fdm-author and forms-user groups to be able to create and work with form data model. Contact your Experience Manager administrator to become a member of the groups.

Create Form Data Model data-sources

Ensure that you have configured the data sources you intend to use in the Form Data Model as described in Configure data sources. Do the following to create a Form Data Model based on configured data sources:

  1. In Experience Manager author instance, navigate to Forms > Data Integrations.

  2. Select Create > Form Data Model.

  3. In the Create Form Data Model dialog:

    • Specify a name for the form data model.
    • (Optional) Specify title, description, and tags for the form data model.
    • (Optional and applicable only if data sources are configured) Select the tick icon next to the Data Source Configuration field and select the configuration node where cloud services for the data sources you want to use reside. It restricts the list of data sources available for selection on the next page to the ones available in the selected configuration node. However, any Experience Manager user profile data sources are listed by default. If you do not select a configuration node, data sources from all configuration nodes are listed.
  4. Select Next.

  5. (Applicable only if data sources are configured) The Select Datasource screen lists available data sources, if any. Select data sources you want to use in the form data model.

  6. Select Create and on the confirmation dialog, select Open to open the Form Data Model editor.

    Let us review the different components of the Form Data Model editor UI.

    A Form Data Model with three data sources - a RESTful service, Experience Manager user profile, and an RDBMS

    A. Data Sources Lists data sources in a form data model. Expand a data source to view its data model objects and services.

    B. Refresh Data Source Definitions Fetches any changes in data source definitions from configured data sources and updates them in the Data Sources tab of the Form Data Model editor.

    C. Model Content area where added data model objects appear.

    D. Services Content area where added data source operations or services appear.

    E. Toolbar Tools to work with form data model. The toolbar shows more options depending on the selected object in form data model.

    F. Add Selected Adds selected data model objects and services to the form data model.

For more information about Form Data Model editor and how you can work with it to edit and configure form data model, see Work with form data model.

Update data sources update

Do the following to add or update data sources to an existing form data model.

  1. Go to Forms > Data Integrations, select the Form Data Model in which you want to add or update data sources, and select Properties.

  2. In the Form Data Model properties, go to the Update Source tab.

    In the Update Source tab:

    • Select the browse icon in the Context-Aware Configuration field and select a configuration node where cloud configuration for the data source you want to add resides. If you do not select a node, cloud configurations residing only in the global node are listed when you select Add Sources.

    • To add a new data source, select Add Sources and select the data sources to add to the form data model. All data sources configured in global and the selected configuration node, if any, are displayed.

    • To replace an existing data source with another data source of the same type, select the Edit icon for the data source and select from the list of available data sources.

    • To delete an existing data source, select the Delete icon for the data source. The Delete icon is disabled if a data model object in the data source is added in the form data model.

      fdm-properties

  3. Select Save & Close to save the updates.

NOTE
Once you add new data sources or update existing data sources in a form data model, ensure that you update the binding references, as appropriate, in Adaptive Forms that use the updated form data model.

Context aware configurations for specific run modes runmode-specific-context-aware-config

Form Data Model utilizes Sling context-aware configurations to support different data source parameters to connect with data sources for different Experience Manager run modes.

When Form Data Model uses cloud configurations to store parameters, which when checked-in and deployed through source control (Cloud-Manager GIT repository) creates cloud configuration with same parameters for all the run modes (Development, Stage, and Production). However, for use cases where there is a need to have different data sets for test and production environments, then we use data source parameters (for example, data source URL) for different Experience Manager run modes.

To achieve this you need to create an OSGi configuration that contains data source parameters-value pairs. This overrides the same pair from Form Data Model cloud configuration at run time. As the OSGi configurations support these run modes by default, you can override a data source parameter to different values based on run mode.

To enable deployment-specific cloud configurations in Form Data Model:

  1. Create cloud configuration on local development instance. For detailed steps, see How to configure data sources.

  2. Store your cloud configuration to file system.

    1. Create package with filter /conf/{foldername}/settings/cloudconfigs/fdm. Use the same {foldername} as in step 1. And replace fdm with azurestorage for Azure storage configuration.
    2. Build and download package. For details, see package actions.
  3. Integrate cloud configuration in Experience Manager Archetype Project.

    1. Unzip the downloaded package.
    2. Copy jcr_root folder and put it your ui.content > src > main > content.
    3. Update ui.content > src > main > content > META-INF > vault > filter.xml to contain filter /conf/{foldername}/settings/cloudconfigs/fdm. For details, see ui.content module of AEM Project Archetype. When this archetype project is deployed through CM pipeline, the same cloud configuration gets installed on all the environments (or runmodes). To change the value of fields (like URL) of cloud configurations based on environment, use the OSGi configuration discussed in the following step.
  4. Create an Apache Sling context aware configuration. To create the OSGi configuration:

    1. Set up OSGi configuration files in Experience Manager Archetype project.
      Create OSGi Factory Configuration files with PID org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider. Create file with same name under each run mode folder where the values need be changed per run mode. For details, see Configuring OSGi for Adobe Experience Manager.

    2. Set the OSGI configuration json. To use Apache Sling Context-Aware Configuration Override Provider:

      1. On local development instance /system/console/configMgr, select factory OSGi configuration with the name Apache Sling Context-Aware Configuration Override Provider: OSGi configuration.
      2. Provide description.
      3. Select enabled.
      4. Under overrides, provide fields that need to be changed based on environment in sling override syntax. For details, see Apache Sling Context-Aware Configuration - Override. For example, cloudconfigs/fdm/{configName}/url="newURL".
        Multiple overrides can be added by selecting +.
      5. Select Save.
      6. To get OSGi Configuration JSON, follow the steps in Generating OSGi Configurations using the AEM SDK Quickstart.
      7. Place JSON in OSGi Factory Configuration Files created in the previous step.
      8. Change the value of newURL based on environment (or runmode).
      9. To change secret value based on runmode, secret variable can be created using cloud manager API and later can be referenced in the OSGi Configuration.
        When this archetype project is deployed through CM pipeline, override will provide different values on different environments (or run mode).
      note note
      NOTE
      Adobe Managed Service users can encrypt the secret values using crypto support (for details, see encryption support for configuration properties and place encrypted text in the value after context aware configurations are vailable in service pack 6.5.13.0.
  5. Refresh the data source definitions using the option to refresh data source definitions in the Form Data Model editor to refresh FDM cache through FDM UI and get the latest configuration.

Next steps next-steps

You now have a Form Data Model with data sources added to it. Next, you can edit the Form Data Model to add and configure data model objects and services, add associations between data model objects, edit properties, add custom data model objects and properties, generate sample data, and so on.

For more information, see Work with form data model.

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab