Query using process varibales

I’m initialising processes with some process variables. In that each process, process variables are like,

in first process,

actor =1 , value =“abc”

in second process,

actor=1, value=“cba”

Is there any option available for querying using this actor variable to get both the values “abc” and “cba” as the actor value is same. Kindly help

Hi John,

as far as I know, variables are stored inside a map using the variable name as key. So using a single key to retrieve each respective value wont work. But due to the fact that you mention of separate processes, it is likely you refer to several instances of the same process. In this case each instance has its own context where a process variable is accessible, but not those of the other running instance. In some cases, you can use the history service.

Can you elaborate more on the exact use case, as this initial question seems kinda broad.


Thank you for your reply. I’ll try to elaborate. Consider an user task. In user task I’m starting the process like this :

  Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("indentNum", indent.getIndentNum());
    variables.put("userType", indent.getUserType());
    variables.put("role", indent.getRole());
    variables.put("bic", indent.getBic());
    variables.put("status", indent.getStatus());
  //  variables.put("actor",indent.getActor());

    System.out.println("Variables "+variables);
    ProcessInstance process_indent_po = runtimeService.startProcessInstanceByKey("Proc2Pay",variables);

    TaskQuery indentInitiators = taskService.createTaskQuery()
    Task toReturn = indentInitiators.singleResult();


So here I’m starting the process with some process variables which I’ll get from the req body. I’m completing the process as well. So let’s consider the value of the variables:

	"status": "Indent Created"

So each time when I’m calling the user task to complete I’m initialising variables with that. So in these variables consider only indentNum is unique. So can I query using the field userType to get all the indentNum available for that particular userType. Because userType is generic. only some roles are there. You got my question? if not pls tell me