Reputation: 6893
I am working on an application where I would like to show the user an interface that shows them the process they need to complete and highlights where in that process they currently are. I cannot seem to find a REST API that would give me this type of information.
For example, workflow has 4 steps, they have completed Step 1 and it is now in Step 2.
> Step 1 > Step 2 > Step 3 > Step 4
I am able to get the current task Step 2
for a user via the /task
endpoint, and I can get Step 1
from the /history/task
endpoint, but I can't seem to get Step 3
and Step 4
. I could pull the xml
from the respective endpoint and parse it, but that seems overkill.
Am I missing something?
Upvotes: 1
Views: 2308
Reputation: 11
Instead of using xml way, found new way to get all the tasks for a particular process definition Key.
using key, pd = repositoryService.PDQuery.PDKey(key).singleresult();
from above value, get the PD Id. with that can get the modelInstance from same repoService.
BpmnModelInstance ins = repositoryService.getBpmnModelInstance(pd.getId());
using above ins, we can get all the tasks.
Upvotes: 1
Reputation: 67
You can get all the job definitions defined in bpmn.xml file through the Camunda REST API
GET: /job-definition?activityIdIn=ServiceTask1,ServiceTask2
And you can also pass additional query parameters listed in this link.
Refer Camunda REST API Documentation
Upvotes: 0
Reputation: 3240
The bpmn.io option listed will provide a list of tasks, however in my experience this doesnt really represent the "Milestones" of a process. Generally it is the milestones that users want to see. For example, in a loan origination process there may be 30 user tasks with multiple levels of approval. Clients dont want to see each task, what they want to see is the stage of the process they are at. e.g. initiation, underwriting, fulfillment etc, etc.
If this is what you are looking for, I would recommend you maintain a variable in the process instance that holds the current milestone in the process.
I tend to use "none" message throw events with an associated listener to set the milestone.
I'm not saying the original answer is not correct, but in my experience, this is not really what end users really want to see.
Hope this helps, Greg
Upvotes: 3
Reputation: 2268
You do not need parsing the xml, you can use bpmn.io for render the process and highlight the actual activity. All necessary information is provided by the camunda REST API.
A simple example can you find here https://github.com/camunda/camunda-consulting/tree/master/snippets/jsf-simple-tasklist
Upvotes: 1