I have a system external to Adobe Experience Manager that I need to make a quick call to whenever an Asset is deleted in AEM. Not being an expert in AEM, my options feel very limited.
I've attempted to create a workflow with a step that can make the appropriate call, and have hooked up a Launcher to listen for a Remove event on any "dam:Asset" type nodes from a certain path in AEM. That means I've got a Java class I've pushed into AEM that extends WorkflowProcess, and is called as part of that workflow.
However, this workflow is not being triggered when I go delete an Asset. If, however, I change the Launcher to listen for a Remove event on "Any Node Type", the workflow is called as I would have expected, however it appears that the asset has already been deleted by the time it hits my process, so the node path provided to my process is already null and void and I'm unable to do anything with it. In any case, I can't leave the Launcher set to fire on "Any Node Type"...
What am I missing? Is there a better way to capture a delete event on an asset? All I need is to be able to gather some information from the deleted node and its children to make this external call. I just need a handle on the Node when a user deletes an Asset...
There's a number of possible problems that are occurring.
In the workflow process step that you have, the contents of the deleted node should have been part of workflow item that you are working on. Or did you attempt to look up the deleted item from within the process?
Additionally, it may be simpler to do an event listener
the problem here is, that as soon as the node (the DAM Asset is implemented as a number of JCR nodes) is gone, you cannot retrieve any information from it anymore.
Therefor even Scott's tip to use a JCR Observation Event handler will not really help here. You need to collect the information upfront, before the asset is actually removed.
I could think of a way, that you run the deletion of an asset through a workflow; and before you finally remove the asset, you collect all the information you need, store it as part of the workflow. And when the asset is gone, you have the information you need to perform your external call.