01-18-2021 12:44 PM
Hello,
I want to create a behavior that cancels associated workflows after file deletion. After some research, I found out that I need to implement the following Behavior/Policie:
public void beforeDeleteNode(final NodeRef nodeRef) { List<WorkflowInstance> activeWorkflow = serviceRegistry.getWorkflowService().getWorkflowsForContent(nodeRef,true); for (WorkflowInstance w : activeWorkflow) { wIds.add(w.getId()); } } public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) { if (wIds.size() > 0) { serviceRegistry.getWorkflowService().cancelWorkflows(wIds); } wIds.clear(); }
My problem is I don't know where or how to implement this, any help is appreciated.
01-19-2021 03:19 AM
You can start with this tutorial on how to implement Alfresco behaviours:
https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html
01-23-2021 04:01 AM
Posting so remember to check incase someone finds a solution.
Explore our Alfresco products with the links below. Use labels to filter content by product module.