I created a custom workflow for the request activation of a page. It's equals at the default workflow, but before activate the page, I added a custom step.
My question is what's the correct way to call my workflow instead of that default.
The solution I thinked and I'm implementing is to override "/libs/wcm/core/content/sites/publishpagewizard" (that is the button "Publish page" in the sidekick in a page), recreating the wizard under "/apps/wcm/core/content/sites/publishpagewizard" and rebuilding the same xml structure, changing only the following properties on the node "/jcr:content/body/items/form/items/wizard/items/publishstep/items/fixedColumns/items/fixedColumn1/items/references": requestActivationWorkflow and scheduleActivationWorkflow. In this way it seems to work and it calls my workflow. But it's correct? The reason of my doubts is because in this way I'm forced to replicate the entire structure of these wizard (publishpagewizard but consequently also the managepublicationwizard, that is the other way to publish now or later a page through the relative button in sites.html), so if with an instance update or an hotfix the structure has changes, it could create me problems.
The other related question is how to trigger the direct activation? Because I need for that custom step I added in my workflows also in the direct activation, that for default calls the servlet "/bin/replicate.json". Otherwise I could change the replicationUrl (an other property under that wizard node), call a custom servlet that does that custom step and then calls the default servlet.
You may need to write a custom workflow step as well to perform time operations (if you want to wait 30 mins for example)\. However, AEM is very flexible in letting you write custom workflow steps. TO learn how to write a custom workflow step that implements,