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.
You can start with this tutorial on how to implement Alfresco behaviours:
https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html
Posting so remember to check incase someone finds a solution.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.