Highlighted

Data not saving to child table(AEM Forms, MySQL)

yohan_aloka

03-05-2018

Hi all,

I'm new to aem, so I'm trying to design a Adaptive Form and persist data to MySQL database.

Database connections are working fine.

AEM Version: 6.3

issue : When i submit the adaptive form, the data to the master table(employee) get saved successfully. but data to the child table (claim) is not saving to the database.

Log : this is the only warning i get when i submit the form

04.05.2018 06:02:38.688 *WARN* [124.43.18.74 [1525413758681] POST /content/forms/af/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest/jcr:content/guideContainer.af.internalsubmit.jsp HTTP/1.1] com.adobe.aemds.guide.internal.impl.utils.SubmitDataCollector TemplateKey not found in merge json:style

04.05.2018 06:02:38.690 *INFO* [124.43.18.74 [1525413758681] POST /content/forms/af/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest/jcr:content/guideContainer.af.internalsubmit.jsp HTTP/1.1] com.adobe.aemds.guide.internal.impl.utils.JsonSchemaUtils Value:  isn't compliant with JSON Schema. It should be number

04.05.2018 06:02:38.690 *INFO* [124.43.18.74 [1525413758681] POST /content/forms/af/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest/jcr:content/guideContainer.af.internalsubmit.jsp HTTP/1.1] com.adobe.aemds.guide.internal.impl.utils.JsonSchemaUtils Value:  isn't compliant with JSON Schema. It should be number

04.05.2018 06:02:38.690 *INFO* [124.43.18.74 [1525413758681] POST /content/forms/af/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest/jcr:content/guideContainer.af.internalsubmit.jsp HTTP/1.1] com.adobe.aemds.guide.internal.impl.utils.JsonSchemaUtils Value:  isn't compliant with JSON Schema. It should be number

04.05.2018 06:02:38.690 *INFO* [124.43.18.74 [1525413758681] POST /content/forms/af/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest/jcr:content/guideContainer.af.internalsubmit.jsp HTTP/1.1] com.adobe.aemds.guide.internal.impl.utils.JsonSchemaUtils Value:  isn't compliant with JSON Schema. It should be number

Full Log Link(9.21MB)

Request to the server when submitting the form captured using firefox:


"afData":
"afUnboundData":
"data":

         }
      },
      "afBoundData":
         "data":
            "employee_1525240639590":
               "personId":8664,
               "familyName":"Kuranage8",
               "givenNames":"Yohan Aloka Perera8",
               "location":"Batuwatta8",
               "locationNumber":11011,
               "jobTitle":"Software Engineer",
               "classification":"None",
               "telephone":"+94717043469",
               "email":"kg.yohan@gmail.com",
               "claim_employee_claim_1525409575878":
                  "totalWorkingClaimDays":"55",
                  "totalNonWorkingClaimDays":"22"
               }
            }
         }
      },
      "afSubmissionInfo":
         "computedMetaInfo":

         },
         "signers":

},
"afPath":"/content/dam/formsanddocuments/claim-for-on-call-allowance/claim-for-on-call-allowance-form-latest",
"afSubmissionTime":"20180504060238"
}
}
}

This is the Data Model Objects of my form.

1479438_pastedImage_0.png

This is the association properties between employee and claim(One to Many).

1479439_pastedImage_1.png

This is the response from server when i test form data modal.

1479441_pastedImage_2.png

This is how i have map data modal objects to the form.

1479442_pastedImage_3.png

properties of Adaptive Form Container related to submission.

1479443_pastedImage_4.png

I hope you will understand my question and help me to solve this.

Thank you & best regards..!

Replies

smacdonald2008

04-05-2018

You can perform this use case in 2 ways

1 - see this doc - -https://helpx.adobe.com/ca/experience-manager/6-3/forms/using/data-integration.html

2 - the second way involves directly using the DataSOurcePool object from an OSGi bundle. You can post the data to an AEM Service (OSGi bundle) and then use the DataSourcePool to write the data to MySQL tables - see [0] and [1]

0 - Adobe Experience Manager Help | Posting Adobe Experience Manager Form Data to Custom Services

1 - Adobe Experience Manager Help | Injecting a DataSourcePool Service into an Adobe Experience Manager ...

The second way gives you much more control.

Highlighted

joed17943519

20-07-2018

Hello, I stumbled upon this when trying to solve the same issue.  My configuration is pretty much the same as above, a parent table with a child table associated (mapped on ID elements) and when I submit data gets written to one and not the other.  In your answer you recommend 2 methods that he could try.  Does that mean that you can NOT submit parent / child data in the intended way by utilizing the OOB functionality with forms , associations, and data models?

I have been troubleshooting this for a bit and my error after submit is

Yet im looking at the submitted JSON and it looks fineScreen Shot 2018-07-20 at 12.01.58 PM.png

Currently testing to see if this is a viable option for a client by building a POC but I dont know how much custom development they are willing to do. Any help would be appreciated

Highlighted

joed17943519

20-07-2018

Scott thanks so much for the quick response!  I usually dont post until I have exhausted all of my other options by searching forums and other resources available to me (like the solution partner portal) Unfortunately I have not found anything that addresses this specific use case (including the additional links you've provided)

This seems like functionality that many would want to have with any data model that is more than one table ...Per my last comment here - Is this functionality supported OOB ?