cancel
Showing results for 
Search instead for 
Did you mean: 

Query WorkflowTasks by Owner (Java API) [Solved]

antoin
Champ in-the-making
Champ in-the-making
Hello there…

I'm trying to query tasks for a given owner with the following approach:




NodeRef person = personService.getPerson("username");

WorkflowTaskQuery query = new WorkflowTaskQuery();
query.setActive(true);
query.setTaskState(WorkflowTaskState.IN_PROGRESS);
query.setTaskName(QName.createQName("http://www.myorg.com/model/workflow/1.0", "myTask"));      
          
Map<QName, Object> queryTaskCustomProps = new HashMap<QName, Object>();
queryTaskCustomProps.put(ContentModel.PROP_OWNER, "HELP HERE");
          
query.setTaskCustomProps(queryTaskCustomProps);
          
List<WorkflowTask> results = workflowService.queryTasks(query, false);



In "HELP HERE" I tried to pass to person NodeRef or just the username… but in both cases the query did not retrieved data. If I remove the query.setTaskCustomProps it works ok, thus I assume the rest is correct.

So… what's the correct value/object in customProps associated to the owner key?

thanks in advance
2 REPLIES 2

antoin
Champ in-the-making
Champ in-the-making
Well, a simple WorkflowTaskQuery.setActorId("username") [sorry, i'm still a beginner] solves that problem… however another doubt related to  setTaskCustomProps: how to query tasks for a specific group?

Debugging (printing the properties map), i saw a property {http://www.alfresco.org/model/bpm/1.0}pooledActors with a value like this: workspace://SpacesStore/GROUP_NAME.

To query, i will need to pass the nodeRef (like the value above) or just the group name?



queryTaskCustomProps.put(QName.createQName(NamespaceService.BPM_MODEL_1_0_URI, "pooledActors"), "MY_GROUP NAME OR NODEREF");
query.setTaskCustomProps(queryTaskCustomProps);



If you have links to tutorials and/or documentation to indicate, related to this issue… i really appreciate

antoin
Champ in-the-making
Champ in-the-making
Solved using:

workflowService.getPooledTasks("GROUP_NAME")

Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.