I am trying to get introduced a new variable in the modeler and get stored its value in any one of the tables and retrieve it back.
@pinturjs, Runtime variables will be persisted in ACT_RU_VARINST table.
public void setProcessVariablesToInstance(String processInstanceBusinessKey) {
Execution execution = runtimeService.createExecutionQuery().processInstanceBusinessKey(processInstanceBusinessKey)
.singleResult();
CustomerDTO customerDTO = CustomerDTO.builder().id("C3462").name("Camunda").address("Germany").build();
ObjectValue customerDataValue = Variables.objectValue(customerDTO)
.serializationDataFormat(Variables.SerializationDataFormats.JAVA).create();
Map<String, Object> variableMap = new HashMap<>();
variableMap.put("customerDataValue", customerDataValue);
variableMap.put("category", "politics");
variableMap.put("activeStatus", true);
runtimeService.setVariables(execution.getId(), variableMap);
StringValue typedStringValue = Variables.stringValue("a string value");
runtimeService.setVariable(execution.getId(), "stringVariable", typedStringValue);
}