Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Schedule Activation Through Custom Workflow in AEM 6.3


Level 3


I am creating a custom workflow which has the following steps in AEM 6.3 :-

1.Dialog participant Step --> This helps user to choose the Activation Date.

2. Process Step --> It saves the date selected in above step as "absoluteTime" in metadata of the workflow instance.

3. Participant Step --> Here I am selecting Timeout as Immediate and Timeout handler as "Absolute Time Auto Advancer" and assigning to admin.

4. Process Step --> Activate page.

But the when I starts the workflow it saves the "absoluteTime" property correctly but it doesn't stop at the second participant step(which is at 3) and workflow gets aborted as soon as it reaches the step 3. Can anyone please point out what wrong I am doing. Attaching the instance history and below is the code which I am using for saving absoluteTime

String contentPagePath = workItem.getWorkflowData().getPayload().toString();

Session session = workflowSession.adaptTo(Session.class);

ResourceResolver resourceResolver = getResourceResolver(session);

Resource resource = resourceResolver.getResource(contentPagePath + "/jcr:content");

ValueMap valueMap = resource.getValueMap();

Calendar calendar = valueMap.get("absoluteTime", Calendar.class);

workItem.getWorkflowData().getMetaDataMap().put("absoluteTime", calendar.getTimeInMillis());wf instance.PNG

3 Replies


Level 10

In your code (I assume step 2 is a custom step) - you are modifying the JCR. However - you are not showing and code that saves the JCR node changes.

Please post the error log too.


Level 3

Hi Scott,

Thanks For your reply. Yes you are right 2nd step is a custom process step which retrieves the value saved in payload JCR and saves it in workflow instance metadata. I was referring this link Scheduled activation with workflows – Adobe AEM Club  for developing my workflow. In OOTB schedule Activation also waiting is done through participant step only. if this is not correct could you please guide which step we should use so as to schedule the activation in the time provided by the author? Also I am not getting any specific error also in error logs.


Level 1


I have the same requirement. Scheduling date and time (Now/Later) for page activation
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap)
throws WorkflowException {
try {
Workflow workflow = workItem.getWorkflow();
// Getting the workflow history
List<HistoryItem> historyList = workflowSession.getHistory(workflow);
if (!historyList.isEmpty()) {
Date absoluteDate = null;
String scheduling = null;
HistoryItem historyItem = historyList.get(historyList.size() - 1);
scheduling = historyItem.getWorkItem().getMetaDataMap().get("schedule", String.class);
if (StringUtils.isNotBlank(historyItem.getWorkItem().getMetaDataMap()
.get(AbsoluteTimeoutHandler.ABS_TIME, String.class))) {
absoluteDate = historyItem.getWorkItem().getMetaDataMap().get(AbsoluteTimeoutHandler.ABS_TIME,
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("saving absoluteTime with [ {} ]", absoluteDate);
if (scheduling.equals("now")) {
// default to now + 1 second
Calendar now = Calendar.getInstance();
int calenderSeconds = 1;
now.add(Calendar.SECOND, calenderSeconds);
absoluteDate = now.getTime();
LOGGER.debug("absoluteDate [ {} ]", absoluteDate);
if (absoluteDate != null) {
workItem.getWorkflow().getMetaDataMap().put(AbsoluteTimeoutHandler.ABS_TIME, absoluteDate.getTime());
workItem.getWorkflowData().getMetaDataMap().put(AbsoluteTimeoutHandler.ABS_TIME, absoluteDate.getTime());
} catch (Exception e) {