Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Calling Scheduled Page/Asset Activation Workflow

Avatar

Level 1

We have a requirement where an author calls a custom workflow that assigns a page to a reviewer who can either activate it immediately or schedule it for activation at a later time (like using Activate Later from the Site Admin toolbar).  We have a step for the assignment and a custom process step and dialog so they can choose to activate later and set a date/time (which behind the scenes we set as the value for absoluteTime in the metadata of the workflow).  We then use a Container Step to call the "Scheduled Page/Asset Activation" workflow.  This all works fine however, unlike when using the "Activate Later" action, the only status icon in the site admin list of pages next to that page is for workflow .  There is no scheduled task icon .  Users need to be able to read the scheduled activation date/time by hovering over this icon just like when using "Activate Later".  I have verified that the "Scheduled Page/Asset Activation" workflow is indeed running for the given payload.  What's more is that if I reboot the CQ instance I now see the workflow icon as well as the scheduled task icon next to the page as I expect.  Hovering over that icon now displays the date/time for activation.  Obviously we can't be restarting the instance every time a reviewer schedules an activation like this.

One thing to note, the scheduled task icon never appears for any workflows other than "Scheduled Page/Asset Activation" (and I think "Scheduled Page/Asset Deactivation") even if I try to mimic it exactly in my custom workflow, therefore the Container Step is necessary.

We are running on Adobe CQ, Version 5.6.0.20130125.

Thanks,

Bryan

1 Accepted Solution

Avatar

Correct answer by
Level 8

My guess is that however the pages.json is generate only recognizes the top layer of the workflow so it isn't reporting the sub-workflow status. When I have had this requirement in the instead of kicking off a sub-workflow I would start a new workflow for the scheduled activation and let the original workflow end, so depending on what your business requirements are that might be a better approach. 

View solution in original post

6 Replies

Avatar

Level 1

Hi Bryan,

I am trying to follow your approach to customize the "activate later" workflow. However, I am failed to save absoluteTime to the metadata of the workflow using a statement like the following

    workItem.getWorkflow().getMetaDataMap().put("absoluteTime", timevalue);

I also found an issue reported in the forum http://forums.adobe.com/message/5216746#5216746 complaining failed to transfer metadata from a step to the next in CQ 5.6. Would you please let me know how to overcome the problem? What API you used to save to the workflow metadata?

Thanks much

-Hong

Avatar

Level 1

Btw, the icons I am referring to are

Workflow : [img]status-workflow.gif[/img]

Scheduled Task : [img]status-scheduledtask.gif[/img]

Avatar

Correct answer by
Level 8

My guess is that however the pages.json is generate only recognizes the top layer of the workflow so it isn't reporting the sub-workflow status. When I have had this requirement in the instead of kicking off a sub-workflow I would start a new workflow for the scheduled activation and let the original workflow end, so depending on what your business requirements are that might be a better approach. 

Avatar

Level 10

Looks like payload map not refreshed. What happens if you just restart [1] without restarting the instance. Is it cluster envirnoment?

[1] http://<host>:<port>/system/console/bundles/com.day.cq.workflow.cq-workflow-impl

Avatar

Level 1

Restarting the com.day.cq.workflow.cq-workflow-impl bundle had no effect however restarting the com.adobe.granite.workflow.core bundle seems to refresh the payload map and the icon appears.

I am trying this on my local machine, no cluster.

Avatar

Level 10

Can you please file a daycare.