Reputation: 59
If a workflow is running on a page and it is in Approver action step where reviewer reviews the contents and approve/rejects the contents. But someone accidentally deleted the page on which WF is running. In such scenario what should be the WF behaviour.? Is there any way to end the WF? Currently, in AEM inbox is showing "unknown resource " in red color and when approve taking action rotating (loading). The reason is there is no resource available. I would like to end the workflow and send the mail to Author.
Upvotes: 0
Views: 902
Reputation: 9462
You can go to
/libs/cq/workflow/content/console.html
and click the Instances tab, then right click and Terminate an existing instance.
This UI is under Tools.
Upvotes: 1
Reputation: 480
Ideally you should lock the payload, so locking payload should be your first step in the workflow this way even if the page is moved, deleted or modified there won't be any issues or red color errors in executing workflow. Make sure to unlock the payload once all the actions are performed on the payload.
Upvotes: 1
Reputation: 3961
Just an extension to i.net's solution. In order to the the script invoked, implement an event listener, which checks if nodes (of type cq:Page
) were removed and then stop the workflows accordingly. You should be able to find the workflows with a simple query.
Upvotes: 1
Reputation: 3444
There is no out of the box solution for this but you can write a simple script step to check for resource existence and terminate in case the resource is deleted or inaccessible. Place the script under /etc/workflows/checkresource.ecma and call it in your workflow. A pseudo script could be:
workflowSession.getSession().itemExists(workflowData.getPayload().toString())
Upvotes: 1