This article demonstrates the ability to store AF data in Data Base as part of an AEM Workflow Step.
The use case is to store the AF data into DataBase using the AEM Workflow.
Please follow the following steps to implement this capability on your system
Download the Zip file and extract its content
Deploy insertdata.core-0.0.1-SNAPSHOT.jar bundle using Felix Web Console
Go to Package Manager and import the package StoreAFInDBWorkflow.zip. This package has sample workflow which stores the AF data into DB. Open the workflow model. The workflow has only one step. This step calls the code written in the bundle to store the AF data into the Database. I am passing an single argument to the process. This is the name of the Adaptive Form whose data is being saved
Go to ConfigMgr
Search for "JDBC Connection Pool"
Create a new Day Commons JDBC Connection Pool
Specify the dababase specific proeprties. In the screen shot below, I am connecting to mysql Database.
The name of the schema is aemforms
specify the username/password for the Data Base
Specify the Data Source Name
Go to ConfigMgr
Search for "Insert Form Data into DB"
Sepcify the properties as follows. The last image shows you the properties I specified on my system
DataSourceName - Name of the datasource you configured previously
TableName - Name of the table in which you want to store the AF Data
FormName - Name of the colum to hold the name of the Form
ColumnName - Name of the column to hold the AF Data
In my example, the name of the table is "formsubmissions"
Name of the column holding the formdata is "formdata"
Name of the column holding the formname is "formname"
To Test the Capability, please follow the steps
Create a AF.
Associate the Adaptive Form with AEM Workflow(StoreAFValuesinDB) as shown in the screen shot below.
Make sure you specify "data.xml" in the data file path
Preview the form and submit
If everything has gone well, you should see the Form Data being stored in the table and column specified by you