cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco: Query workflow tasks for a list of users

amekki
Champ on-the-rise
Champ on-the-rise
I would like to be able to query workflow tasks assigned to a list of users using Activiti. For instance, query tasks assigned to user1 or user2. I have read the code of WorkflowServiceImpl.java and ActivitiWorkflowEnginge.java, actually WorkflowTaskQuery is able to query tasks assigned to only 1 user. I can't find how to create a new method that adds the feature I need: I did not understand how the query is converted and what exactly I can modify. I thought if it is possible to use luceneSearch for such query.

Thanks,
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Hello,

unfortunately, Lucene / SOLR search can not be used for wWorkflow queries because workflows and tasks are not indexed by default. The only way to query in standard Alfresco is via databse query, and this is what the workflow service does. Unfortunately, this means there are some restrictions in place regarding the complexity of a query so that the execution does not take ages and can be expressed in dynamically generated SQL (via statement templates).

Your best bet in your case would be to build a service facade / web script around workflow service and execute multiple single user / group queries to aggregate all relevant tasks / workflows, or query all tasks / workflows of a specific type and apply a post-processing filter to the results.

It is theoretically possible to search workflows / tasks via SOLR / Lucene by hooking in some low-level replication / duplication logic so the data they contain is represented via regular Alfresco nodes and thus picked up during indexing / search. We did a proof-of-concept for this internally and it is working quite well. It is of course a pretty significant change within the core services of Alfresco.

Regards
Axel

amekki
Champ on-the-rise
Champ on-the-rise
I would like to thank you.
I have read the jbpm source code and it is possible to change on the SQL query but for activiti it seems to be so difficult.

theonax
Champ in-the-making
Champ in-the-making
Hi,
I was wondering if there is a possibility to enable indexing for workflows and tasks so Lucene / SOLR search could be used?
I know that in Alfresco 4.2 it was possible to search tasks by queries like
TYPE:"bpm:workflowTask"


In Alfresco 5.1 it is not working anymore.
Is there a simple way to enable indexing?

Thanks for answer

afaust
Legendary Innovator
Legendary Innovator
In Alfresco 4.2 it definitely was not possible to search for tasks using the TYPE query you posted, unless you have a custom addon that duplicates tasks from the jBPM / Activiti workflow engine as nodes in the Alfresco stores.
Since workflow data is stored in a completely distinct / separate table structure, the Alfresco indexing and searching components can't support these. I have - in the past - created a commercial addon that duplicates workflow and task data as nodes (as mentioned in the first line) and thus made them searchable. Unfortunately that addon was customer-specific and is not generally available. Either way enabling indexing for tasks / workflows requires some serious development to work around the data separation and data redundancy issues.

Regards
Axel

theonax
Champ in-the-making
Champ in-the-making
Thanks for the lead.
Actually I was using a custom addon (Citeck) and I did not realize they implemented their own tasks / workflows duplicating mechanism.
I thought it was a core Alfresco functionality.
Too bad the addon is not fully migrated to 5.1 and thus tasks cannot be searched.
Looks like I will have to wait for the next release.