Get Process Instance (and Parents)

Hey :slight_smile:
we are currently working on a Camunda 8 Migration. In a few parts of our code we use the RuntimeService to fetch additional information regarding running jobs. For example we like to get the highest parent ProcessInstance key. Previously we simply used the RuntimeService to get the ProcessInstance and its parents. Now I don’t know any way to fetch current ProcessInstance. The only information I get is the ProcessInstance key from the ActivatedJob.
Is this possible at all? Using the REST API manually seems to be a difficult way considerung performance and development effort.

Hello @floricdev ,

information about parent process instances can be found in the Operate REST API:

The process instance has a field parentKey. You should be able to traverse process instances until there is no more parent left.

I hope this helps

Jonathan

Yes, I saw this API. Somehow I hoped there would be a way using the Java based client instead of doing manual REST requests. On the other hand it’s good to see the potencial performance impact and likeliness of HTTP request failures.

Hello @floricdev ,

there is a Java based client. You can find it in the community hub:

Jonathan