Skip to main content

Adobe

Customizing Request for Activation/Deactivation Wizards in AEM 6

In AEM 6.3+, there is a feature that allows content authors to “Request Publication” or “Request Unpublication.” The option becomes available when the content author does not have replication permission crx:replicate on the page they are currently authoring. See image below:

Banner Photo by rawpixel on Unsplash


 

The Publish/Unpublish Page Wizard

Once the author clicks on “Request Publication,” the “Publish Page” wizard opens (see image below), and it offers a few options:

  1. It lists all Configs, Policies and Referenced assets so that it also can be requested to be published
  2. It allows you to schedule the publication
  3. It allows you to enter a description for the workflow that will be triggered (more on that below)

 

The “Request Unpublication” wizard is very similar, except it offers the option to unpublish a page but does not look for references.


By default, the OOTB “Request For Activation” workflow will be triggered for the page and all of the references/configs/policies selected in the wizard.

The OOTB “Request For Activation” workflow is located here: /libs/settings/workflow/models/request_for_activation

 

The Manage Publication Wizard

There is a second way to publish/unpublish pages, and that is the “Manage Publication” wizard. Here is how to get to it:

Once you click on “Manage Publication,” the wizard opens:

Once you go through the wizard, again,  the OOTB “Request For Activation” workflow will be triggered.
Customizing All The Wizards

DISCLAIMER: Everything here was discovered and done on AEM 6.4 SP3. Although, I’d think it should be the same on AEM 6.3+. Let me know in the comments if you find otherwise.

There is one small section on how to customize the wizard in the AEM docs here. But it only covers the “Manage Publication” wizard and not the other two wizards: “Publish Page” and “Unpublish Page Wizard.”

Overlaying Manage Publication Wizard:

Location in libs: /libs/wcm/core/content/common/managepublicationwizard but it’s an override of /libs/cq/gui/content/common/managepublicationwizard
Create the same wizard path, but under /apps, so: /apps/cq/gui/content/common/managepublicationwizard

You could also overlay /libs/wcm/core/content/common/managepublicationwizard, I went with /apps/cq/gui/content/common/managepublicationwizard because I already started doing it and did not want to change.

Then you can use this node structure:

Please note the use of sling:resourceSuperType="/libs/cq/gui/content/common/managepublicationwizard"  (See Konrad’s comment below)

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="nt:unstructured"
    sling:resourceSuperType="/libs/cq/gui/content/common/managepublicationwizard">
    <body jcr:primaryType="nt:unstructured">
        <items jcr:primaryType="nt:unstructured">
            <form jcr:primaryType="nt:unstructured">
                <granite:data jcr:primaryType="nt:unstructured"
                    requestActivationWorkflow="/etc/workflow/models/custom-request-for-activation/jcr:content/model"
                    requestDeactivationWorkflow="/etc/workflow/models/custom-request-for-deactivation/jcr:content/mode"/>
            </form>
        </items>
    </body>
</jcr:root>

 
 

Overlaying Publish Page Wizard:

Location in libs: /libs/wcm/core/content/sites/publishpagewizard
Create the same wizard path, but under /apps, so: /apps/wcm/core/content/sites/publishpagewizard. Then you can use this node structure:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="cq:Page">
    <jcr:content jcr:primaryType="nt:unstructured">
        <body jcr:primaryType="nt:unstructured">
            <items jcr:primaryType="nt:unstructured">
                <form jcr:primaryType="nt:unstructured">
                    <items jcr:primaryType="nt:unstructured">
                        <wizard jcr:primaryType="nt:unstructured"
                            jcr:title="Custom Publish">
                            <items jcr:primaryType="nt:unstructured">
                                <publishstep jcr:primaryType="nt:unstructured">
                                    <items jcr:primaryType="nt:unstructured">
                                        <fixedColumns jcr:primaryType="nt:unstructured">
                                            <items jcr:primaryType="nt:unstructured">
                                                <fixedColumn1 jcr:primaryType="nt:unstructured">
                                                    <items jcr:primaryType="nt:unstructured">
                                                        <references
                                                            jcr:primaryType="nt:unstructured"
                                                            sling:resourceType="cq/gui/components/siteadmin/admin/publishwizard/references"
                                                            requestActivationWorkflow="/etc/workflow/models/custom-request-for-activation/jcr:content/model"/>
                                                    </items>
                                                </fixedColumn1>
                                            </items>
                                        </fixedColumns>
                                    </items>
                                </publishstep>
                            </items>
                        </wizard>
                    </items>
                </form>
            </items>
        </body>
    </jcr:content>
</jcr:root>

 
 

Overlaying Unpublish Page Wizard:

Location in libs: /libs/wcm/core/content/sites/unpublishpagewizard
Create the same wizard path, but under /apps, so: /apps/wcm/core/content/sites/unpublishpagewizard. Then you can use this node structure:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="cq:Page">
    <jcr:content jcr:primaryType="nt:unstructured">
        <body jcr:primaryType="nt:unstructured">
            <items jcr:primaryType="nt:unstructured">
                <form jcr:primaryType="nt:unstructured">
                    <items jcr:primaryType="nt:unstructured">
                        <wizard
                            jcr:primaryType="nt:unstructured"
                            jcr:title="Custom Unpublish">
                            <items jcr:primaryType="nt:unstructured">
                                <unpublishstep jcr:primaryType="nt:unstructured">
                                    <items jcr:primaryType="nt:unstructured">
                                        <fixedColumns jcr:primaryType="nt:unstructured">
                                            <items jcr:primaryType="nt:unstructured">
                                                <fixedColumn1 jcr:primaryType="nt:unstructured">
                                                    <items jcr:primaryType="nt:unstructured">
                                                        <references
                                                            jcr:primaryType="nt:unstructured"
                                                            sling:resourceType="cq/gui/components/siteadmin/admin/unpublishwizard/references"
                                                            requestDeactivationWorkflow="/etc/workflow/models/custom-request-for-deactivation/jcr:content/model"/>
                                                    </items>
                                                </fixedColumn1>
                                            </items>
                                        </fixedColumns>
                                    </items>
                                </unpublishstep>
                            </items>
                        </wizard>
                    </items>
                </form>
            </items>
        </body>
    </jcr:content>
</jcr:root>

 

Very Important Notes

  1. I am using the same structure as the path I’m overlaying, but only updating the properties that I want to update. Namely: requestActivationWorkflow requestDeactivationWorkflow
  2. You could explore the structure under libs, you can override titles and button texts, you can also override the OOTB schedule activation/deactivation. Did not need to in my case.
  3. The path I am using for the workflow is /etc/workflow/models/custom-request-for-deactivation/jcr:content/mode even though my actual workflow model is under path /conf/global/settings/workflow/models/custom-request-for-activation I am not sure why this is, but I found it to work. If you know the answer to this, let me know in the comments!

 

The Cherry on Top

A package with all the overlays above: Download Package
 

Thoughts on “Customizing Request for Activation/Deactivation Wizards in AEM 6”

  1. The overlay in “/apps/cq/gui/content/common/managepublicationwizard” does not work for me in AEM 6.5.3 because AEM is always calling the dialog via “/mnt/override/libs/wcm/core/content/common/managepublicationwizard.html”. Therefore regular overlays are not considered. But you can just place an override in “/apps/cq/gui/content/common/managepublicationwizard” and make sure you set the property sling:resourceSuperType=”/libs/cq/gui/content/common/managepublicationwizard” on the root node. That way the contents from “/apps/cq/gui/content/common/managepublicationwizard” and “/libs/cq/gui/content/common/managepublicationwizard” are merged

  2. Thanks Konrad!
    I do actually have that
    sling:resourceSuperType="/libs/cq/gui/content/common/managepublicationwizard"
    property set on my node: "/apps/cq/gui/content/common/managepublicationwizard"
    But it seems I’ve missed including it in the post, I have updated that! Thanks a lot!

  3. Hi Ahmed,

    I have one requirement : – If user deactivates a page/cf/xf (unpublishes or deletes) we will look for assets on the page and see if they are referenced anywhere else in AEM. If there are no other references, we will prompt the user to see if they can be remove from the DAM. If the user responds yes we will remove those assets. If they respond no, we will keep them as-is. If there are multiple assets on the page perhaps we can show a checkbox list so they can choose which to remove.

    Can you please suggest how this can be taken forward.

    thanks,
    Piyush

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ahmed Musallam, Adobe Technical Lead

Ahmed is an Adobe Technical Lead and expert in the Adobe Experience Cloud.

More from this Author

Categories
Follow Us