In AEM Forms OSGI- we will have to write a custom OSGi bundle to set JSON data element's value. The bundle is provided as part of this tutorial.
We use Process Step in AEM workflow. We associate the "Set Value of Element in
We need to pass two arguments to the set value bundle. The first argument is the path to the element whose value needs to be set. The second argument is the value that needs to be set.
For example, in the above screenshot, we are setting the value of the
In our example, we have a simple Time Off Request Form. The initiator of this form fills in his/her name and the time
Based on the initial step fields value we show the approver panel where the "manager" can approve or reject the request.
Please take a look at the rules set against "Initial Step". Based on the value of the
To deploy the assets on your local system
Download and extract the content of the zip file
Point your browser to Felix console
Deploy the SetValueApp.core-1.0-SNAPSHOT.jar bundle and start the bundle
Point your browser to package manager
Import and install the TimeOffRequestJsonData.zip. This has the sample workflow model
Point your browser to Forms and Documents to upload the sample form. This form was built using AEM Forms 6.4. Please make sure you are on AEM Forms 6.4
Click Create | File Upload
Upload the TimeOffRequestForm.zip
Open the form
Fill in the Start and End Dates and submit the form.
Logout of AEM.
Login as 'manager/password"
Go to "Inbox"
Open the "Manager Approves" form.
Notice the fields in the first panel are disabled.
Notice the panel for approving or declining the request.
Since we are pre-populating form using user profile, make sure the admin user profile information is set.
You can enable debug logging by enabling logger for
by pointing your browser to http://localhost:4502/system/console/slinglog
The OSGi bundle for setting value of data elements in JSON Data currently supports the ability to set one element value at one time. If you want to set multiple element values, you will need to use process step multiple times.
Make sure the Data File path in the Adaptive Form's submission options is set to "Data.xml". This is because the process step looks for a file called Data.xml under the payload folder