Publish referenced assets in custom workflow | Community
Skip to main content
kavitak12
June 22, 2019
Solved

Publish referenced assets in custom workflow

  • June 22, 2019
  • 3 replies
  • 1676 views

Hi,

In my current custom workflow referenced items are not getting published. I want to have a functionality similar to OOTB publish workflow where it gives a popup in publish wizard and asks if we want to activate referenced items as well. Can you please help me as to how can I implement the same behaviour for custom workflow?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

The popup is not part of the workflow itself, but part of the "activation" logic.

Workflows run async and are not directly connected to a browser window, thus they cannot render HTML and send it as response to a user.

If you have a custom workflow, you can either replicate the activation feature (most likely to can reuse the complete logic and UI then), start the reference search first and as a final step put all that information into your custom workflow. This allows a limited amount of interactive work, but it's more complicated than a simple workflow, which just runs in the background and has no feedback channel.

Or you just implement a workflow step (as usual) and use the ReferenceSearch class [1] to find all other objects in the repo which are referencing your page.

[1] ReferenceSearch (The Adobe AEM Quickstart and Web Application.)  (note that this is not a service, but a simple object!!)

3 replies

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
June 22, 2019

The popup is not part of the workflow itself, but part of the "activation" logic.

Workflows run async and are not directly connected to a browser window, thus they cannot render HTML and send it as response to a user.

If you have a custom workflow, you can either replicate the activation feature (most likely to can reuse the complete logic and UI then), start the reference search first and as a final step put all that information into your custom workflow. This allows a limited amount of interactive work, but it's more complicated than a simple workflow, which just runs in the background and has no feedback channel.

Or you just implement a workflow step (as usual) and use the ReferenceSearch class [1] to find all other objects in the repo which are referencing your page.

[1] ReferenceSearch (The Adobe AEM Quickstart and Web Application.)  (note that this is not a service, but a simple object!!)

kavitak12
kavitak12Author
June 25, 2019

Thanks much Joerg for detailed explanation and solutions.

2nd solution would be appropriate for my custom workflow. However, for our requirement, we need to make use of com.day.cq.dam.commons.util.AssetReferenceSearch API to search the assets which are referenced in particular page we want to activate.

joerghoh
Adobe Employee
Adobe Employee
June 25, 2019

That is straight forward then. Implement a custom workflow step which instantiates an AssetReferenceSearch object, execute the search method and replicate each resulting asset.

Of course you don't have a popup window then, but it's all done automatically.

Jörg