Customizing Request for Activation/Deactivation Wizards in AEM 6 | Perficient Digital

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:

<?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">
    <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

 

Leave a Reply