Configuring Adaptive Form to trigger AEM Workflow
- Topics:
- Workflow
CREATED FOR:
- Beginner
- Developer
Prerequisites
The sample form used in this workflow is based on a custom adaptive form template which needs to be imported into your AEM server. The sample form that is provided needs to be imported after importing the template.
Get the Adaptive Form Templates
- Download Adaptive Form Template
- Import the template using package manager
- Upload and install the Adaptive Form template
Get the sample Adaptive Form
- Download Adaptive Form
- Browse to Form And Documents
- Click Create -> File Upload
- The sample adaptive form is placed in a folder called Application Forms
The following video explains how to configure an Adaptive Form to trigger an AEM Workflow
So now that our workflow is configured and complete, it’s time to trigger this workflow by submitting an adaptive form. But before you configure adaptive form with this workflow, make sure that your workflow is synced here by clicking on the Synced button. So let’s now take a look at the form that will be used to trigger that workflow. So this is our form here. Let’s open up its properties and make sure the form is configured to generate a document of record here by selecting this option. This option is important because our workflow will be generating a document of record, and we need to associate a template with this particular form. So make sure you have this option selected. The next thing we need to do is to configure that active form to trigger that workflow. So we open this form in the edit mode.
Go to its form container properties here.
And open up the submission tab here. and make sure the submit action is “invoke an AEM workflow.” There are a number of submit actions available to use, some are out of the box, and some of them here are custom. So select invoke AEM workflow, and select the workflow model here. “Review submitted data.” And the data file path is called Data.xml. Make sure this is the same name that you have specified in your workflow. So if you go to the workflow, and in the set variables we have used a file name called Data.xml while mapping the submitted data variable here. So we are saying that relative to payload, there’s a file called Data.xml. And in our form, we are saying save the submitted data in a file called Data.xml relative to the payload. So make sure these file names match. Since our form does not have any attachments or any document of record that we need to store, we’re going to leave them as blank. So the next thing we need to do now is to preview the workflow, preview the form, fill out some information, and hit the submit button to trigger the workflow. So let’s preview the form here. Fill out some information here.
Marital status is married, so the details are filled in. Then go to the income tab here. I’m going to fill in some values here.
Rental income.
I’m going to give a salary of, say, 2,000. So remember, our workflow will route based on the grand total. If grand total is more than 10,000 it will be routed to a particular person. If not, it will be routed to another person. Then in the assets tab, we can quickly do cash, say, 4,000. So now our form is complete. Let’s click on the submit button.
So when you hit the submit button, the workflow will be triggered and an appropriate task will be assigned to the user. So in our case, we are going to use administrator as the person to whom the task is assigned. So I have logged into AEM here in my AEM instance, as an administrator. And then this is the inbox where you see all the tasks. So click on view all, and here is a task which says greater than $10,000. And this was assigned a few seconds ago. So if I were to open this task, I see the form here. That’s the same form with the data repopulated from the submitted form here. So the data is all there. And if you notice, there are two action buttons here, approve and reject, because we configured our assigned task with these two actions and the icons are also showing up here nicely. There’s a check mark icon, and there’s a reject icon here. So if I click on the approve button here, the workflow will be completed, and it will go the route as we are defined in our workflow. So now my workflow is complete. So to see what steps your workflow did, you can go into the workflow models here.
Go into the workflow model, workflow, and go into the archive because our workflow is complete. So this is the workflow that was complete. And you can look at its history here. So the history was, these are the history and there’s greater than 10k generated a document of record because we clicked on the approve button. So the next video, we will take a look at how the data is stored and where the data is stored in the CRX repository. -
The following video shows you the workflow payload and other details in the crx repository