Creating workflow to review submitted data
Workflows are typically used to route submitted data for review and approval. Workflows are created using the workflow editor in AEM. The Workflows can be triggered on Adaptive Form submission. The following steps will walk you through the process of creating your first workflow.
Please make sure you have a working instance of AEM Forms. Please follow the installation guide to install and configure AEM Forms
Create Workflow Model
- Click on Create -> Create Model
- Provide a meaningful Title and Name such as Review Submitted Data .
- Gently tap the newly created workflow and click on the Edit icon.
- Workflow is opened in edit mode. The workflow by default has one component called Step1 . Select this component and click delete icon to delete the component.
- Listed on the left are the various workflow components that can be used to build your workflow. You can filter the components by Forms Workflow type.
- Click on the variable's icon to create new variables. Variables are used to store values. AEM Forms provides a number of variable types that can be created. Today we will create a variable of type XML to hold the Adaptive Form's submitted data. Create a new variable called submittedData of type XML as shown in the image below.If the form is based on Form Data Model the submitted data is in JSON format and in that case you will create a variable of type JSON to hold the submitted data.
- Click on the steps icon on the left to list the various workflow components. Drag and drop Set Variable component onto your workflow on the right. Make sure you place the Set Variable component below the Flow Start.
- Click on the Set Variable component and then click on the Wrench icon to open the property sheet of the component.
- Click on the Mapping Tab->Add Mapping->Map Variable. Set the values as shown in the screen shot below.
Add workflow components
- Drag and drop Assign Task component on to the right - hand side below the Set Variable component.
- Click on the Assign Task component and then click on the Wrench icon to open the property sheet.
- Provide meaningful Title to the Assign Task component.
- Click on Forms and Documents tab and set the following properties as shown in the screen shot
- 1 By selecting this option the workflow is not coupled with specific Adaptive Form.
- 2 The workflow engine looks for file called Data.xml relative to the payload in the repository
- Click on Assignee tab. Here you can assign the task to a user in your organization. For this use case we are going to assign the task to admin user as shown in the screen shot below.
- Save your changes by clicking on the Done icon of the component
- Click on Sync to generate the runtime model of the workflow. Your workflow model is now ready and can be associated with Adaptive Form's submit action.