Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to store multifield data in JCR properties not in JCR node

Avatar

Level 3

Below is the structure of my multifield dialog in template page component. once I author this mutlified in page properties, I want data to be stored in page jcr:content properties rather than in JCR node.

Usually it is being stored like this in node type
Untitled.png
Instead above I wanted to store styleLevel3And4 inside jcr:content as a property value like below.

Untitled1.png How I can achieve that, thank you.

               <style_3and4
jcr:primaryType="nt:unstructured"
jcr:title="Style for levels 3 &amp; 4"
sling:resourceType="granite/ui/components/coral/foundation/form/fieldset"
title="Style for levels 3 &amp; 4">
<items jcr:primaryType="nt:unstructured">
<style_few_items
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
cq-msm-lockable="styleLevel3And4"
fieldLabel="Style configuration(⚠ Editing is only possible in Blueprint and Standalone)">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./styleLevel3And4">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<path_page_level_2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathbrowser"
fieldLabel="Path to page on level 2"
name="./pathPageLevel2"
rootPath="/content"/>
</items>
</column>
</items>
</field>
</style_few_items>
</items>
</style_3and4>

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Here is an example you can check

<listItems jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
  composite="{Boolean}false"
  fieldDescription="Click 'Add Field' to add more domain link in list."
  fieldLabel="Domain Link List"
  required="{Boolean}true">
  <field jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    name="./domainLinks"/>
</listItems>

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Here is an example you can check

<listItems jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
  composite="{Boolean}false"
  fieldDescription="Click 'Add Field' to add more domain link in list."
  fieldLabel="Domain Link List"
  required="{Boolean}true">
  <field jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    name="./domainLinks"/>
</listItems>

Avatar

Level 3

 

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
          xmlns:cq="http://www.day.com/jcr/cq/1.0"
          xmlns:jcr="http://www.jcp.org/jcr/1.0"
          xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
          jcr:primaryType="nt:unstructured"
          jcr:title="Navigation"
          sling:resourceType="cq/gui/components/authoring/dialog">
    <content jcr:primaryType="nt:unstructured"
             sling:resourceType="granite/ui/components/foundation/container">
        <items jcr:primaryType="nt:unstructured">
            <tabs jcr:primaryType="nt:unstructured"
                  sling:resourceType="granite/ui/components/foundation/container">
                <layout jcr:primaryType="nt:unstructured"
                        sling:resourceType="granite/ui/components/foundation/layouts/tabs"
                        type="nav" />
                <items jcr:primaryType="nt:unstructured">
                    <navigationitems jcr:primaryType="nt:unstructured"
                                     jcr:title="Navigation Items"
                                     sling:resourceType="granite/ui/components/foundation/section">
                        <layout jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
                                margin="{Boolean}false" />
                        <items jcr:primaryType="nt:unstructured">
                            <column jcr:primaryType="nt:unstructured"
                                    sling:resourceType="granite/ui/components/foundation/container">
                                <items jcr:primaryType="nt:unstructured">
                                    <navigationitems jcr:primaryType="nt:unstructured"
                                                     sling:resourceType="granite/ui/components/foundation/form/multifield"
                                                     class="full-width"
                                                     fieldDescription="Click 'Add field' to add a new item"
                                                     fieldLabel="Navigation Items">
                                        <field jcr:primaryType="nt:unstructured"
                                               sling:resourceType="granite/ui/components/foundation/form/fieldset"
                                               acs-commons-nested="JSON_STORE"
                                               name="./navigationItems">
                                            <layout jcr:primaryType="nt:unstructured"
                                                    sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
                                                    method="absolute" />
                                            <items jcr:primaryType="nt:unstructured">
                                                <column jcr:primaryType="nt:unstructured"
                                                        sling:resourceType="granite/ui/components/foundation/container">
                                                    <items jcr:primaryType="nt:unstructured">
                                                        <link jcr:primaryType="nt:unstructured"
                                                              sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
                                                              fieldLabel="Link"
                                                              name="./linkURL"
                                                              rootPath="/content" />
                                                    </items>
                                                </column>
                                            </items>
                                        </field>
                                    </navigationitems>
                                </items>
                            </column>
                        </items>
                    </navigationitems>
                </items>
            </tabs>
        </items>
    </content>
</jcr:root>

 

Followed same dialog structure, but data is being stored in node format not in jcr property inside jcr:content

 

Avatar

Level 3

navigationItems String {"linkURL":"/content/corporate/en_US/products-and-customers/customers"} like this I want to store inside jcr:content page properties not node type.