Expand my Community achievements bar.

SOLVED

CancelInheritance for child pages

Avatar

Level 2

Hi all,

We got a requirement to  run workflow on parent page to cancel inheritance for child pages of a parent page the inheritance should cancel for child page properties and child page components what's the best way to do this,

 do we need to iterate through all child pages and then iterate through components of page and do cancelinheritance

was there any other way to acheive this.

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 5
5 Replies

Avatar

Correct answer by
Level 5

Avatar

Level 2

Thank You.

Avatar

Level 7

Use the LiveRelationshipManager API in AEM to:
1. Retrieve live copies (child pages) of the parent or blueprint page.
2. Use the cancelRelationship() method to break inheritance for each child page.

This approach eliminates the need for manual iteration through child pages and components.

Avatar

Level 2

Thank you.

Avatar

Employee Advisor

Hi Team,

 

1. Iterate Through Child Pages and Components

  • You would start by identifying the parent page and retrieving all its child pages programmatically.
  • For each child page:
    • Cancel inheritance for the page properties using the LiveRelationshipManager API.
    • Iterate through the components of each child page and cancel inheritance for individual components.

This approach ensures granular control over the inheritance-breaking process for both page properties and components.

Example Workflow:

  • Create a custom workflow that:
    • Accepts the parent page as input.
    • Uses the PageManager to fetch child pages.
    • Iterates through the child pages and their components to cancel inheritance.