Search code examples
javaadobeaem

Adobe AEM WorkFlow activate a page including child pages


I want to activate a page also include it's child pages using workflow like below

Parent Node

・Child Node 1
・Child Node 2
・Child Node 3

Requirement is: Is it possible ??? Please give solution also in comment...... thank you very much!!!


Solution

  • You can use the Replicator api to activate the pages.

    In your workflow process step. You can do the following

    currentPage = getCurrentPagePath(); // this is something which you have to figure out, this depends on your workflow code i.e how exactly your workflow got triggered.

    Now,

    Iterator<Page> childPages = currentPage.listChildren();
    

    Now iterate over the child pages and for each child page, do the following

    replicator.replicate(session,repplicationActionType, childPagePath);
    

    You can get the instance of replicator using OSGi dependency injection.

    @Reference
    public Replicator replicator