Flowable (REST-only): How to get “where am I” and the exact path taken for one process run?

Hey there!

We are working with Flowable as our workflow engine in java, but our code is in typescript and we communicate with the engine via RESTful API calls.

I’m working on a feature trying to understand 2 things (given a processInstanceId) -

  1. Current position - on which node a current workflow instance run is on? (“where am I?”)
  2. Actual path - the ordered list of activities that really executed in this run (e.g. model has node1→node2→node3, but this run did node1→node3 so the final result should be [“node1”,“node3”]).

I’ve tried many things but mostly - “/runtime/executions” for the active tree and “/history/historic-activity-instances” (+ variables) to rebuild the path. This breaks in parallel/multi-instance (parallelForEach) and async cases: inner nodes use different executionIds, and runtime rows disappear after completion (executions are done and deleted so i cant query their activities).

Question: Is there a REST-only, recommended approach (or example) to (a) get current activity the instance is on and (b) reconstruct the exact visited activities with a stable parent/child mapping in history? Happy to share a small BPMN + payloads if useful.

Hi,

where am I: you can be on many nodes in one process instance as you can have plenty of parallel executions. That’s why where am I must rely on the executions and their activityId.

Path: Look in the historic activities.

Regards

Martin

ok so here’s a little context -

we implemented a mechanism where we send some object as a variable when starting a workflow instance, for the simplicity of this explanation lets just call it “insightId”.
so every workflow instance must have at least one “insightId”, and can possibly have many "insightId"s.

when running the workflow instance, a simple node will work on all insights, and whenever we fan-out (fork-gateway) then wherever we fanned-out holds which insights went in which direction.

my actual task is to find where every insight is currently standing in the workflow instance.

so yes, I’m aware that a process instance may have plenty of parallel active executions, I’m actually trying to get the those parallel active executions, but the issue is that when I query “/runtime/executions” I get many execution, on some of them I can say with 100% certainty that there are NO insights currently standing on them at all (so i don’t know why the executions still even exist in the runtime table).

Also, when querying “/runtime/executions/{executionId}/activities” I sometimes get more than 1 activity, which doesn’t make sense as i cant be on 4 nodes at the same time in the same execution.
so my more accurate question regarding the “where am I?” is - how can get the ACTUAL activities that are running now in the workflow instance?

from there my plan was to use every execution’s “parentId” attribute to go back recursively and find where did we fan-out so i can actually attach “this insight is on this node”.

the issue with the follow-up plan is that executions that are over are deleted, so when searching for the “parentId” of an execution, that parent doesn’t exist anymore so i can’t query his activities to build the history path or query his variables to find the “insightId”, so this is the second issue of “actual path we went through”.

I tried querying “/query/historic-activity-instances” but when not scoped by executions i don’t have enough data to find the activities and which insight is on which activity, my guess is that I’m completely missing something here :disappointed: