I would like to retrieve a list of all tasks from my bpmn, with or without an activity in it, containing their Id as well as their candidate group. Is this possible at all? If so how?
For context: I would like to show a tasklist that also shows tasks without any process instance in it.
Hey AwesomeEmig and welcome to the Camunda Community!
Have you taken a look into the REST documentation?
Would this method fulfil the purpose of yours?
https://docs.camunda.org/manual/latest/reference/rest/task/get-query/
Let me know if this solves your problem.
Best,
Thomas
1 Like
Hey Hafflgav, thank you very much for your answer!
How would I go about implementing this using the services provided in the following doc: Overview (camunda BPM Javadocs 7.3.7-ee)
Maybe by using taskService?
Your link refers to “Get Task” Query, so maybe something like
taskService.createTaskQuery().taskCandidateGroupIn(myCandidate)
?
Though that returns a List of active Task Instances, rather than a plain list of all the Tasks with their Id and Candidate Group.
Hey, sorry for the long time to get back to you.
So in case you want to use the Java API I would modify your call a bit.
If your call doesn’t work maybe try something like this. Apparently I haven’t had time to test it properly.
processEngine.getTaskService().createTaskQuery().active().list()
This should definitively return all active tasks, which can be also standalone tasks.
Btw. those javadocs you referenced are pretty old. Our current version is 7.16.
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.16/
1 Like
Hey, sorry for my even later reply! I went on vacation after that day
I tried your mentioned approach and I retrieve a list of tasks within active processInstances:
[Task[0108a8a7-76a8-11eb-84ec-024271fe2073], Task[011c1cda-ccc3-11ea-8572-5b8b0b6b51bf], Task[03079e67-e303-11eb-98b3-024271fe2073], ...
But what I much rather need is the following:
I have 3 tasks. Let’s say there is an activity in Task 1. If I do as you said, I will only retrieve one Task - the one activity from the process instance. But I would like to retrieve a list of 3 task objects, containing the informations deposited within their taskboxes, detached from all activity instances, so only the raw information of what is seen in the process definition:
My hope is to get three objects with one for example containing all the informations: Id, Name, Assignee, Candidate Groups, etc.
Thanks a lot for your help so far!
Hey @AwesomeEmig!
No problemo, hopefully you have enjoyed your vacation
Regarding your question: That is apparently not that easy… Especially since it is not clear which properties are actually set during execution.
The only thing which came to my mind is to fetch the process definition from the engine and to try interpret the xml in such a way that you get these three objects and the information from the property panel. (using such a query: Get BPMN 2.0 XML | docs.camunda.org)
But what are you trying to do with this information? Maybe there is another way you could achieve the same result
1 Like