What is the best way to trigger a workflow on page activation ?




There is a requirement for a page to go through the approval process before page is replicated.

I have gone through adobe documentation : https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/customizing-page-aut horing-touch.html#CustomizingtheRequestforActivationWorkflow

I followed the steps as per documentation and overlay-ed /libs/wcm/core/content/common/managepublicationwizard.

But it didn't work and did some analysis as below :

We have 2 types of publishing a page in AEM :

1. manage publication in sites.html

Go to sites.html -> select a page -> in the menu look for Manage Publication , click it
you will be directed to /libs/wcm/core/content/common/managepublicationwizard.html -> next -> next -> the workflow that is used for publication is the Scheduled Page/Asset Activation.

So overlaying /libs/wcm/core/content/common/managepublicationwizard will not trigger Request for Activation workflow.

2. when the user doesn't have the access right and gets the option "request publication"

go to sites.html -> edit a page -> click "request publication" option.

you will be directed to http://aem-local:4502/libs/wcm/core/content/sites/publishpagewizard.html?item=/content/abc&editmode&... -> click request publication

Request for activation workflow will be triggered and if a date is selected scheduled for activation workflow will be triggered.

If we want to trigger a custom workflow , following changes needs to to be done:

1. Overlay /libs/wcm/core/content/sites/publishpagewizard into apps.
2. Go to /apps/wcm/core/content/sites/publishpagewizard/jcr:content/body/items/form/items/wizard/items/publishstep/items/fixedColumns/items/fixedColumn1/items/references
3. changes the value of requestActivationWorkflow property to point to your model (/etc/workflow/models/request_for_activation/jcr:content/model to /etc/workflow/models/custom-request-for-activation/jcr:content/model)
4. change the value of scheduleActivationWorkflow property to point to your model.
5. Go to the page and click on request publication , custom workflow will be triggered.

So we need to create 2 custom models to set the values for : scheduleActivationWorkflow and requestActivationWorkflow , but this works only for request publication when author doesn't have all permissions.

How about manage publication and content tree activation ?

Is this the correct way of triggering the workflow and if so,the documentation is not correct or is there any other approach ?








If you want to modify OOTB functionality then you have to overlay and do changes.

For approval page activation, why don't you suggest content author to use create->Workflow option for activate page.

You can hide request for activation and manage publication options for content author and they will be having only option to activate page using custom workflow, you can provide option to schedule workflow also in custom model.




They are attempting to describe how to modify the Request for Activation workflow. This doc is not clear at all. We will raise a doc bug. (ie -  Update the workflow model and related configurations/scripts as required)

We just wrote a HELPX Article that shows use of the Replication API and we modify this workflow to use the custom step that uses the Replication API. See this:

Adobe Experience Manager Help | Replicating Adobe Experience Manager Content using the Replication A...

As you can see in the article - the page does go through an approval process before its replicated.




You can simply use, request for activation workflow. and modify the approver step to add the correct/right approvers. If you need more than 1 approvals, you can add as many approval steps as you need in it and define the next steps as per your need.