Rest - Get tasks list by taskVariables

Hello !

I need to use taskVariables in Usertasks to contextualize.
I created a process and assigned an input variable (example : a = b) to my userTask.

BPMN:
example.bpmn (2.6 KB)

But when I’m trying to request the engine with Rest API, I have no results.
http://localhost:8180/engine-rest/task/?processDefinitionKey=process_example&taskVariables=a_eq_b

See taskVariables in the guide:

With the debug logging i see:


2019-06-27 16:15:32,125 DEBUG [org.camunda.bpm.engine.cmd] (pool-10-thread-1) ENGINE-13006 Finishing command -------------------- AcquireJobsCmd ----------------------
2019-06-27 16:15:32,125 DEBUG [org.camunda.bpm.engine.jobexecutor] (pool-10-thread-1) ENGINE-14022 Acquired 0 jobs for process engine ‘default’:
2019-06-27 16:15:32,125 DEBUG [org.camunda.bpm.engine.jobexecutor] (pool-10-thread-1) ENGINE-14011 Job acquisition thread sleeping for 59996 millis
2019-06-27 16:15:36,595 DEBUG [org.camunda.bpm.engine.cmd] (default task-71) ENGINE-13005 Starting command -------------------- TaskQueryImpl ----------------------
2019-06-27 16:15:36,595 DEBUG [org.camunda.bpm.engine.cmd] (default task-71) ENGINE-13009 opening new command context
2019-06-27 16:15:36,599 FINE [org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria] (default task-71) ==> Preparing: select distinct RES.REV_, RES.ID_, RES.NAME_, RES.PARENT_TASK_ID_, RES.DESCRIPTION_, RES.PRIORITY_, RES.CREATE_TIME_, RES.OWNER_, RES.ASSIGNEE_, RES.DELEGATION_, RES.EXECUTION_ID_, RES.PROC_INST_ID_, RES.PROC_DEF_ID_, RES.CASE_EXECUTION_ID_, RES.CASE_INST_ID_, RES.CASE_DEF_ID_, RES.TASK_DEF_KEY_, RES.DUE_DATE_, RES.FOLLOW_UP_DATE_, RES.SUSPENSION_STATE_, RES.TENANT_ID_ from ACT_RU_TASK RES inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_ WHERE ( 1 = 1 and D.KEY_ = ? and EXISTS ( select ID_ from ACT_RU_VARIABLE WHERE NAME_= ? and RES.ID_ = TASK_ID_ and ( ( TYPE_ is not null and TYPE_ = ? and TEXT_ is not null and TEXT_ = ? ) ) ) ) order by RES.ID_ asc LIMIT ? OFFSET ?
2019-06-27 16:15:36,599 FINE [org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria] (default task-71) ==> Parameters: process_example(String), a(String), string(String), b(String), 2147483647(Integer), 0(Integer)
2019-06-27 16:15:36,600 FINE [org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria] (default task-71) <== Total: 0
2019-06-27 16:15:36,601 DEBUG [org.camunda.bpm.engine.cmd] (default task-71) ENGINE-13011 closing existing command context

The SQL tries to read from ACT_RU_VARIABLE.TASK_ID_ which is null for all my records.

Could you help me please !

Thanks

Which is the version of Camunda which you use?

I’m using 7.9 version.

Could you please verify if the variable is with task scope or process. You can check if the entries in the database have assigned process instance id.

Yana,

This is my act_ru_variable content:

There is an assigned process instance id.

As you can see in the Cockpit screenshot previously provided the variable “a” has a scope “User Task”.

Here is my database without the content of act_ru_meter_log table:
camunda.txt (578.5 KB)

Anyone ?
I need to fix this before switching to enterprise edition.

Hi @CLZ,

Have a look at below post by @thorben

https://groups.google.com/d/msg/camunda-bpm-users/tO7hFPYEF5U/bsXtiYJfBwAJ

Input parameters for user tasks do not become task-local but execution-local variables (i.e. local variables of the execution executing the activity)