Coral Multifield(6.4 Touch UI) to save value in JSON

monikaa6

13-12-2018

Hi All,

We are upgrading from AEM 6.0 to AEM 6.4. We have some existing xtype which I am trying to implement in Touch UI.

Our existing data for multifield is stored as json

for e.g

When I try to use the "granite/ui/components/coral/foundation/form/multifield"

It stores the data as Node structure in AEM 6.4.

Does anyone have implemented Custom Javascript to save the multifield value as JSON,

Any help or pointers to the samples will be helpful.

Thanks,

Monika

Accepted Solutions (1)

Accepted Solutions (1)

edubey

13-12-2018

That the default product implementation to create nodes for multifield data. One approach has been already suggested to you for ACS commons but it seems you cant install it.

Another approach which I have seen some folks following to tackle this problem it to

1. Update your code to read from node instead of json

2. A small script, to convert all such node (you can find by resourcetype using query) and save them node.

Effort will be minor but approach will help you for long term and without having dependency on acs-commons.

Answers (9)

Answers (9)

smacdonald2008

14-12-2018

Great Answer Praveen/Arun - we marked it correct.

As mentioned already by 2 AEM Experts -- granite/coral MF stores data as nodes. It works and there is no issue when AEM reads these nodes to populate web pages as discussed in this document -- Building Experience Manager Components using Granite/Coral Resource Types

If you need JSON - you use ACS and Granite 2 MF - not granite/coral.

edubey

14-12-2018

Customer is not able to use ACS commons due to some restriction on their end.

For any upgrade, best would be structure your content with 6.4 practices having minor efforts in place

Ravi_Pampana

MVP

14-12-2018

Check below file in acs-commons which will store values as json. The below file has example of cq:dialog

/apps/acs-commons/touchui-widgets/composite-multifield/source/touchui-composite-multifield.js

vipins5188

14-12-2018

Arun Patidar​ Acs commons touch widget store has option to store data as node or json . Using acs common widget js, we created our multifield and it is storing data as json in crxde.

Arun_Patidar

MVP

14-12-2018

Hi,

Granite Multifield stores data multifield item as node not json with or without ACS Common, so ACS common is not gonna help in your case.

As edubey​ suggested, write a utility to convert node to json and use returned JSON response in your HTL/Java. A small piece of code can help.

vipins5188

14-12-2018

Hi Monika,

You can overlay the acs commons js and create you own multi-field. We did the same due to restrictions policy.

Register your custom multifield like CUI.Widget.registry.register("multifield", CUI.Multifield); Copy acs commons js code to your code, define proper js categories and use your multifield in dialog. No code changes required from your end

Hope this helps.

monikaa6

13-12-2018

Thanks Vipin for your reply. Is there any other way of doing this (other than adding the "acs-commons-nested" property.) We cannot install acs commons package in our environments due to some policies.

vipins5188

13-12-2018

Hi,

There is acs commons widget available to store value as node as well as in json structure.

Please refer below article for step by step implementation.

Using the ACS AEM Commons Nested Multifield | Bounteous

Focus on "acs-commons-nested=JSON_STORE" property, it is working fine in 6.4 as well.