Trouble with Nested Quotes for JSON in FEEL Expression

I am trying to call the Operate API from a BPMN in order to retrieve a process instance key.

The reason I’m doing this from a BPMN is that my client is trying to follow an all Connectors approach and have minimal custom code in a Java application.

My approach and problem:

  • Use Operate’s Variable API (/v1/variables/search) to find the process instance key based on our custom request ID.
  • In the Swagger UI, I can filter on variable value like:
{
  "filter": {
    "value": "\"TEST123\""
  }
}
  • If I try a similar filter using either the REST or Operate Connector, additional escape characters are added in front of my existing \ . For example:
    {"filter":{"value":"\\\"TEST123\\\""}
  • This results in no records being found.
  • I have tried dozens of different permutations to get this to work and have not had success.
  • The reason we have to use a String for the Request ID is because the actual IDs are 19 digits long and if we put these in a process variable without converting to string, the value gets modified.
  • I also have a need to filter on a JSON value like:
{
  "filter": {
    "value": "{\"highBits\":  \"TEST123\", \"lowBits\": \"TEST345\"}"
  }
}

My workaround for now is to use the Process Instance Search API, filter on ProcessId, and sort by most recent first. With that, I then call the Variable Search API and filter on processInstanceKey to confirm I’ve got the correct instance before proceeding.

My use case is retrieving statistics and sequence flows via the Operate API in order to facilitate nesting a live BPMN diagram with tokens in another UI.
I’ve read in other posts that there is no mechanism to for an instance to retrieve its own or other process instance keys and that we should instead use a custom identifier. Given that many of the API calls require a process instance key, it seems that we need to use this custom identifier to retrieve the process instance key. Is there an easier way to do this?

How are you passing the values to your connector?

Hello @slate83 ,

this is because of a currently existing bug. The zeebe team is already aware and will be working on a fix.

Jonathan

Hi @slate83,

As a workaround for the time when you cannot access technical process instance data with FEEL, you can write your own connector that saves these technical attributes as process variables, maybe in a single variable in JSON format.

This should be much easier than querying the Operate API and make assumptions in the recent process instance.

Hope this helps, Ingo