02-16-2018 05:49 AM
[version: Alfresco Community 5.2]
I need to create functionality, which removes all active workflow instances but only for specified workflow definition.
For instance, document may be a part of many diffrent workflows, e.g. "New Task", "Review and Approve" and so on. More, there may be lot of instances of each workflows active at the same time. I'd like to remove all instances of "Review and Approve" workflow but left "New Task" still active.
02-16-2018 06:32 AM
You can create a webscript and check whether the workflows which are running on particular node.
private static final String[] ENABLE_WORKFLOW_LIST = {"New Task"};
List<WorkflowInstance> workflowInstanceList = workflowService.getWorkflowsForContent(nodeRef, true);
for (WorkflowInstance workflowInstance : workflowInstanceList) {//Make check for workflow something like below
if (!Arrays.asList(WORKFLOW_LIST).contains(workflowInstance.getDefinition().getTitle())) {
//Perform the action which you want to do
}
}
If you dont know how to create webscript you can refer below link for more details.
02-18-2018 06:13 AM
Thanks. I did it exactly like that. I just was wondering if there is some simpler method that does not require coding.
Explore our Alfresco products with the links below. Use labels to filter content by product module.