Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

10 Replies

Avatar

Level 3

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.

Avatar

Level 3

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.

Avatar

Correct answer by
Level 10

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.

Avatar

Level 3

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.

Avatar

Community Advisor

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.



Arun Patidar

Avatar

Level 3

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.

Avatar

Community Advisor

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

Avatar

Level 10

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

Avatar

Level 10

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.

Avatar

Level 3

Thanks all for all the inputs.