Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM 6.3 : Getting properties of dynamic child node created in multifield component after it is authored

Avatar

Level 4

Hi I'm using AEM 6.3 Touch-UI

This is the dailog.xml for multi field in separate column

1536077_pastedImage_0.png

This is the dynamic node structure  item0, item1 and item2 created under page after I've authored the multi field component thrice...

1536078_pastedImage_1.png

I tried to pas the parameters through <sly data-sly-use.linkInfo="subLinkLogic.js" @ resPath = item.path>

with the below code, will the linkType property of the dynamic nodes is set to childLinkType ?

TIA

"use strict";

use(function () {

var locResPath = this.resPath;

granite.resource.resolve(locResPath).then(function(child) {

        properties.resolve(child);

    });

    return properties;

    var childLinkType = locResPath.properties.get("linkType");

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

As Scott stated, I too prefer sling models to work with Multifield in AEM 6.3.

And also, it is very easy as compared to WCMUsePOJO.

You can refer the article provided by Scott..It works nicely: Building Experience Manager Components using Granite/Coral Resource Types

Thanks,

Ratna Kumar.

View solution in original post

4 Replies

Avatar

Level 10

Using a Multifield in AEM 6.3 is best when working with AEM Sling Models.

Building Experience Manager Components using Granite/Coral Resource Types

You use the @Inject annotation to inject the Multifield:

@Inject

    @Optional

    public Resource products;  //products corresponds to the multifield dialog node.

This shows you how to work with a MF and display the results in the component.

Using JavaSctipt to read a multifield is not best practice. Sling Models is much better.

Then you write out the values like this:

<h2>This is your AEM HTML Template Language component with a Multifield</h2>

<div

    data-sly-use.multiItems="com.aem.summit.core.models.HeroSlingModel">

    <div data-sly-list.head="${multiItems.products.listChildren}">

        <p><b>Description:</b> ${head.product}</p>

       <p><b>Selected Path value:</b> ${head.pathbr}</p>

        <p><b>Date:</b> ${'yyyy-MM-dd HH:mm:ss.SSSXXX' @ format= head.startDate, timezone='UTC'}</p>

       <p><b>Country:</b> ${head.size}</p

       <p><b>CHeckbox:</b> ${head.show}</p>

       <p><b>Fruit:</b> ${head.fruit}</p>   

      <hr>

   </div>

</div>

Avatar

Correct answer by
Community Advisor

Hi,

As Scott stated, I too prefer sling models to work with Multifield in AEM 6.3.

And also, it is very easy as compared to WCMUsePOJO.

You can refer the article provided by Scott..It works nicely: Building Experience Manager Components using Granite/Coral Resource Types

Thanks,

Ratna Kumar.

Avatar

Level 10

Thats the purpose of the community articles - to show working examples. I am glad you got it working.