I need to cancel workflow programmatically when folder is updated, I can use the rule to call script, but I have no idea how to write script, that will stop workflow that was started for this folder.
Can somebody help me with it?
Solved! Go to Solution.
This is how I can do it
for each ( wf in document.activeWorkflows )
{
workflow.getInstance(wf.id).remove();
}
If it is important, this is my script to start workflow
var date = new Date(new Date().getTime());
date.setMinutes(date.getMinutes()+20);
var workflow = actions.create('start-workflow');
workflow.parameters['bpm:workflowDueDate'] =date;
workflow.parameters.workflowName = 'activiti$validationProcess';
workflow.parameters['bpm:workflowDescription'] =date.getHours()+":"+date.getMinutes()+". Check "+document.name;
workflow.parameters['bpm:assignee']=people.getPerson("admin");
workflow.parameters['sendEMailNotifications'] = false;
workflow.execute(document);
This is how I can do it
for each ( wf in document.activeWorkflows )
{
workflow.getInstance(wf.id).remove();
}
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.