Facing issue with InheritanceValueMap | Community
Skip to main content
Level 7
March 6, 2025
Solved

Facing issue with InheritanceValueMap

  • March 6, 2025
  • 2 replies
  • 550 views

Hello Team,

 

I have a page property:  isMyPage of Type: String

This page property is enabled/ disabled in language node.
Ex: /content/abc/xyz/fr/en, /content/abc/xyz/fr/fr, Ex: /content/abc/xyz/gb/en

 

I have written logic in my custom sling model.

 

 

@ScriptVariable private Page currentPage; private InheritanceValueMap inheritanceValueMap; void init(){ inheritanceValueMap = Optional.ofNullable(currentPage.getContentResource()) .map(resource -> resource.adaptTo(HierarchyNodeInheritanceValueMap.class)) .orElseGet( () -> new HierarchyNodeInheritanceValueMap(currentPage.getContentResource())); if (inheritanceValueMap != null) { Boolean inheritedValue = inheritanceValueMap.getInherited("isMyPage", Boolean.FALSE); } }

 

I have enabled the property in these pages
/content/abc/xyz/fr/en,
/content/abc/xyz/gb/en

This works for, when i open the page:
http://localhost:4502/content/abc/xyz/fr/en/home/support
value of inheritedValue is true.


http://localhost:4502/content/abc/xyz/gb/en/home/support
value of inheritedValue is false.

Not sure, why I am getting false in above case.

 

Thanks

cc @arunpatidar  @lukasz-m  @sureshdhulipudi 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sady_Rifat

For this path: /content/abc/xyz/gb/en/home/support

Have you checked in CRX if the isMyPage property for the home or support page is set to false?

The logic works as follows:

  • If isMyPage is not found, the system will retrieve data from the nearest parent.
  • If isMyPage is explicitly set (either in home or support), it will pick the closest available data instead.

2 replies

Sady_Rifat
Community Advisor
Sady_RifatCommunity AdvisorAccepted solution
Community Advisor
March 6, 2025

For this path: /content/abc/xyz/gb/en/home/support

Have you checked in CRX if the isMyPage property for the home or support page is set to false?

The logic works as follows:

  • If isMyPage is not found, the system will retrieve data from the nearest parent.
  • If isMyPage is explicitly set (either in home or support), it will pick the closest available data instead.
Level 7
March 6, 2025

Hi @sady_rifat 

 

My bad 😞  By mistake, property was present in home page. Now, I have removed that one. Now, feature works fine.

 

Thanks a lot for your quick help.

arunpatidar
Community Advisor
Community Advisor
March 6, 2025