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

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
Adobe Summit 2023 | Complete list of AEM Sessions & Labs
SOLVED

HTL Getting Property value from parent component

Avatar

Level 3

I have a component that has a certain property applied in a dialog. This component has a parsys for dragging in other components.

These 'child' components need to be able to read a property from the 'parent' component. How can this be achieved using the Javascript-use API?

1 Accepted Solution

Avatar

Correct answer by
Employee

Here an example:


"use strict";
use(function () {
    var parent = resource.getParent();
    var props = parent.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);

    return props.get("jcr:createdBy","");

});

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

Here an example:


"use strict";
use(function () {
    var parent = resource.getParent();
    var props = parent.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);

    return props.get("jcr:createdBy","");

});

Avatar

Level 3

Thanks! This is perfect (minus the extra line of code of course). 

PS, I attended your sessions at Summit this year, really enjoyed them!