If the dialogs are already authored and if you convert them to Granite type then multifield dialogs fields would not be prepopulated without already authored data.
There are multiple solutions to pre-populate multifield fields with JSON data, the one is to create node structure from JSON.
In this article, I will show one of the approaches, to convert JSON data to node data.
Suppose if the dialog has a multifield item like below :
https://github.com/arunpatidar02/aem63app-repo/blob/master/packages/tmp/dialog-snippet1.xml
after dialog authored the values are stored in a JSON format.
To make the above dialog compatible with coral3, the data should be stored in a node under iItems. like below:
Note: The dialog fields should be changed separately from coral2 to coral3 resourcetype.
The below servlet runs SQL2 query and look for the touchmulti component and convert JSON data to nodes, so it will be compatible with coarl3 multifield and prepopulate the authored data.
Code:
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/MultifieldConvertCoral2to3Servlet.java
No comments:
Post a Comment
If you have any doubts or questions, please let us know.