January 3, 2021
Estimated Post Reading Time ~

AEM - Touch UI - Coral2 JSON store to Coral3 node store conversion

In Touch UI, Coral2 multifield with ACS common allow multifield data to stored as JSON but when you are going to migrate to Coral3/Granite type, new Granite type store multifield data in nodes not in JSON.

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


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.