Get result process instance camunda spring boot

I want to know the result of this execution flow, success or failure. And what service task failed?

file BMNP
checkCus.bpmn (24.6 KB)

I want to know which service task
to stop

Hi Frederick,

First, let me briefly talk about the difference between a process model and a process instance. The model acts as a blueprint for the instance. This means, each model can be executed multiple times. So when you ask for the result of the flow, you actually looking for the result of a process instance.

To get information about an instance, you need its ID.

Second, let me distinguish between a result and a failure. When a service task fails, the process instance does not automatically complete. Instead, an incident is raised, which allows users to intervene and fix the instance.

You can use the REST API to check whether there have been any incidents:

Third, a process has no return value. To get a result, you either have to send a message or you need to check the variables. You can use the history service/API to get information about past process instances, i.e., its variables or past activities:

thank you StephanHaarmann,
when the process is complete, I want to get the service task active last

Sure, you can use the following endpoint:

Search for all activity instances of your process instance. Order the result (DESC) by endTime.
Add the query parameter with maxResults with value 1:

/history/activity-instance?maxResults=1

{
  "processInstanceId": "yourid",
  "sorting": {
    "sortBy": "endTime",
    "sortOrder": "desc"
  }
}
1 Like

Thank you StephanHaarmann,
It worked. :grinning: