Checking for an existing running instance

Hello everyone. I have a particular need to a process…
I want to track tickets. Basically, we will have a 1:1 process for these tickets. In the database, we have an entry for each of these tickets, as well as a state, in this case, new, processing, and closed. We have a “master” flow that scans the database and kicks off a monitor for each flow in the “new” state. However, we need to be able to also have tickets that are in the “processing” state also monitored. Is there some way that I can check if a process is running that is handling a ticket?

Hi
Assuming each ticket has a unique identifier, when you start a process you could use the ticket I’d as the business key. You can then query running instances based on business key…

Regards

Rob

How do I do that?

Sorry, I don’t think I was clear. By asking “How do I do that?” I meant how do you set the business key from inside of a camunda flow?

You have to put it when you start a process.
https://docs.camunda.org/manual/7.7/reference/rest/process-definition/post-start-process-instance/

More info:

Do you have it when you start the process? If not, put a process variable that will hold a value for you that you will be able to search for.

Hi @iscariot_TF,

right now it is possible to set the business key from delegate code: https://docs.camunda.org/manual/7.13/user-guide/process-engine/delegation-code/#set-business-key-from-delegation-code,

i.e. from a listener or a service task.

Hope this helps, Ingo

Just wondering, can that be done in a code box inside a flow with Groovy?

Oh, and is there a listing of all the execution settings we can use? I know there’s execution.setVariable, execution.getVariable but how many other elements are there?