Starting with AEM Forms 6.4, we now have the ability to invoke Form Data Model Service as a step in AEM Workflow. This article will walk you through a sample use case for posting Document of Record using Form Data Model Service.
The use case is as follows:
Form Data Model Tab - Properties
In the Service Input tab we map the following
file(The Binary Object that needs to be stored) with DOR.pdf property relative to payload. What that means is when the Adaptive Form is submitted, the Document Of Record that is generated will be stored in a file called DOR.pdf relative to the workflow payload.Make sure this DOR.pdf is the same that you provide when configuring the Adaptive Form’s submission property.
fileName - This is the name by which the binary object will be stored in DAM. So you want this property to be dynamically generated, so that each fileName would be unique per submission. For this purpose we have used the process step in the workflow to create metadata property called filename and set its value to combination of Member Name and Account Number of the person submitting the form. For example if the member name of the person is John Jacobs and his account number is 9846, the file name would be John Jacobs_9846.pdf
Service Input
Trouble Shooting Tips - If for some reason the DOR.pdf is not created in DAM, reset the data source authentication settings by clicking here. These are the AEM authentication settings, which by default is admin/admin.
To test this capability on your server, please follow the steps mentioned below:
1.Deploy the Developingwithserviceuser bundle
Download and deploy the setvalue bundle.This custom OSGI bundle is used to create metadata property and set its value from the submitted form data.
Import the assets associated with this article into AEM using the package manager.You will get the following
Point your browser to open the Adaptive Form
Fill the form and submit.
Check the Assets application if the Document of Record is created and stored.
Swagger File used in creating the data source is available for your reference