Expand my Community achievements bar.

Custom Post-Generation Workflow Prevents UI Completion Notification

Avatar

Level 1

When using a custom post-generation workflow in AEM Guides Cloud, the UI notification becomes stuck on "In Progress - Generating <output>..." indefinitely. In my case, I was using a Native PDF output preset. Even though the success message "hangs," and the PDF is generated successfully, and the workflow completes without errors.

I'm using AEM Guides as part of the cloud service.

Symptoms

  1. PDF generation completes successfully
  2. Custom workflow executes and completes (verified in logs)
  3. FinalizePostPublish step runs successfully
  4. PDF file is created in /content/dam/fmdita-outputs/pdfs/
  5. BUT: UI notification stays stuck on "In Progress..." forever
  6. No success notification or download link appears

 

Root Cause Analysis

After investigation, I discovered that the output history node shows two different status properties:

Location of output history: /var/dxml/metadata/outputHistory/ <id> / <id> 

With Custom Workflow:

cloudStatus: "Finished" outputStatus: "Post-Publishing" <-- Never updates to Finished 

Without Custom Workflow (default behavior):

cloudStatus: "Finished" outputStatus: "Finished" <-- Updates to Finished


The Issue:
My logic is, the AEM Guides UI must poll the outputStatus property (not cloudStatus) to determine when to show the completion notification. When using a custom post-generation workflow, the FinalizePostPublish step sets cloudStatus but does NOT set outputStatus to "Finished", leaving it stuck at "Post-Publishing".

Workflow Structure That Fails

START → Custom Step → FinalizePostPublish → END

Note: for both steps "Handle Advance" is checks

My workaround

START → Custom Step(s) → FinalizePostPublish → Step to manually the Set Output Status to Finished → END

Using something like this, in another workflow step after the Finalize post gen workflow step:  props.put("outputStatus", "Finished"); 

Questions

  1. Is this the intended behavior for custom post-generation workflows?
  2. Should FinalizePostPublish be updated to set both status properties consistently?
  3. Can the documentation be updated to include this requirement?

 

4 Replies

Avatar

Level 1

Note: FinalizePostPublish (com.adobe.fmdita.publishworkflow.FinalizePostPublish) is the back-end name for the Finalize Post Generation step. 

Avatar

Employee

@jacobdi3 : as I understand it seems the custom workflow step is somehow depending on property under output history nodes and the "Finished" status update of "FinalizePostPublish" is failing - could be due to a race condition.

 

For clarity, can you share what are the steps performed in custom post generation workflow step?

Avatar

Level 1

Hi Divraj,

Thanks for looking into this.

My custom workflow step performs metadata copying from the source DITAMAP to the generated PDF output. Here's what it does:

  1. Reads the payload path (the source DITAMAP) from workItem.getWorkflowData().getPayload()
  2. Retrieves the generated PDF path from workflow metadata via workItem.getWorkflowData().getMetaDataMap().get("generatedPath", String.class)
  3. Copies metadata properties from the DITAMAP's /jcr:content/metadata node to the PDF's /jcr:content/metadata node (This includes custom fields from a metadata schema)
  4. Commits changes via resolver.commit()

Important: My workflow step does NOT read from or write to any output history nodes (/var/dxml/metadata/outputHistory/). It only interacts with the DAM assets themselves (source DITAMAP and generated PDF metadata nodes).

 

Complete workflow

START → CopyMetadataToPdf → FinalizePostPublish → SetOutputStatusFinished → END

 

The SetOutputStatusFinished step reads outputHistoryPath from the workflow metadata (which AEM Guides provides), then explicitly sets outputStatus = "Finished" on that node and commits. This triggers the UI completion notification.

 

Given that my metadata copy step doesn't touch the output history nodes at all, I don't believe this is a race condition with my custom step. The outputStatus property simply never gets set to "Finished" when any custom post-generation workflow is used - the issue is reproducible even with a minimal custom workflow.

Avatar

Employee

@jacobdi3 : just to confirm few more things - is it possible to:

1. Add a delay in the custom workflow steps (lets say sleep for 5 seconds) - so that it can call FinaliPostGeneration after that delay

2. Confirm if you have enabled microservices for publishing?

3. refresh the session object (before reading metadata and then before committing the changes to repo) in custom workflow step?

 

These are few things that will help us isolate the problem.