cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove all workflow instances in Alfresco 5.1

bernard
Champ in-the-making
Champ in-the-making

I'm purging all unused content on old server Alfresco 5.1. 
Now in Alfresco database is about 15 000 completed and active workflows associated with documents.
I would find out how to remove these workflows instances.
I tried to use standard command in workflow console,

delete all workflows imeanit

but it doesn't work (it runs very slowly and with errors). I can check count of workflow instances in Activity Explorer.

Also I tried to use some ready JS scripts. For example, one of them:

var workflowDefinitions = workflow.getAllDefinitions();
    for (i in workflowDefinitions) {
       var workflowDefinition = workflowDefinitions[i]
       logger.error("Def:" + workflowDefinition.id);
       var workflowInstances = workflowDefinition.activeInstances;
       for (j in workflowInstances) {
          wfInst = workflowInstances[j];
          logger.error("   Inst:" + wfInst.id);
          wfInst['delete']();
       }
    }
}

Unfortanly, it doesn't work for me too.

I know that modifying Alfresco sql db directly is not so good way.
However, I have question, is is possible to remove all workflows by deleted required entries (activiti) in sql database?

2 REPLIES 2

vidhipanchal
Star Contributor
Star Contributor

Hi,

I think it is possible to remove all workflows from database but I am not sure about it. 

Instead of removing workflows from database, you can create custom webscript to remove all workflows using WorkflowService.

Thanks,

Vidhi

ContCentric 

Regards,
Vidhi

malekgn
Confirmed Champ
Confirmed Champ

Hello,

Yes you can remove all workflows by deleting data in specific tables. Those tables are which start by "act_hi" and "act_ru".

Note: I had the same issue, when I try to remove much workflow instances, 15 000 in your example. So I gave a limit number 300 or 400 for example and it works fine.

I hope that my solution helps some.

Best regards.