I’m trying to start a human task with some system-managed variables. I’ve tried to do with plant item transition builder but probably fail to understand what kind of variables
childTaskVariables does set, because seems those aren’t persisted into the
act_ru_variable table so I cannot use for search query API.
cmmnRuntimeService.createPlanItemInstanceTransitionBuilder(request.getPlanItemInstanceId()) .childTaskVariables(mapToVariables(request)) .start();
I’ve ended up doing this by starting a human task plan item, then retrieving searching it, and then setting variables via task service.
cmmnRuntimeService.createPlanItemInstanceTransitionBuilder(request.getPlanItemInstanceId()).start(); Task task = cmmnTaskService.createTaskQuery().planItemInstanceId(request.getPlanItemInstanceId()).singleResult(); cmmnTaskService.setVariablesLocal(task.getId(), mapToVariables(request));
But that seems like the wrong way to do it. I would prefer to create a task with variables in one step or at least under some kind of transaction. Any way to achieve this in a “cleaner” way?