Recommended reads

An adaptive form can have an associated Submit action that triggers when you submit the form. In addition, you can trigger an AEM Workflow on the submitted data.

Consider a scenario where you associate Store Content (deprecated) as the Submit action for an adaptive form. The action creates a node (sling:Folder) that contains the data you submit.

Perform the following steps to trigger an AEM workflow that reads data from the payload you submit. In addition, the workflow fetches your name and email address and sends you an email confirming your data submission.

Create an adaptive form with the required payload (email and user name).

Create a model to define the workflow after you submit the form.

Create workflow components.

Define the workflow model.

Link the model to an event (in this case, the creation of sling:Folder during form submission).

Creating an adaptive form

Create an XML schema-based Adaptive Form with the fields Enter User Name and Email id for user name and email retrieval, respectively. Click here to download the package with XML Schema-based Adaptive Form.

Configure the Email Service for messageGatewayService to not have a null value.

This code relies on the first instance of the email id and the name that appears in the XML file you submit. The data is stored in the jcr:dataproperty of the node that is created based on the data you submit.

Authoring the workflow model

Примечание.

The new component is not yet displayed on the Edit page for the model. Switch to the design mode and enable the component group for the component.

Drag your component. Edit the component, and select an email template. Alternatively, create a template and save the model.

Create a small email template.

Check the handler for auto transition between steps in the workflow.

Launching the workflow

Trigger the workflow process on a specific event. Navigate to the Workflow user interface, and click the Launcher tab to add a launcher.

Select created as EventType, sling:Folder as NodeType, and /content/user generated/content/forms/af as the path. Select Email on AF Submission as your workflow mode. Also, based on your topology, select the run mode (author, publish, or both).

To test the workflow, open the adaptive form, fill in the details, and click Submit.