Reputation: 1435
I am using Activiti version 6.0.0 and trying to set transient variables when starting process or completing task. Documentation for transient variables states:
Transient variables can be got and/or set in most places where regular variables are exposed:
1. On DelegateExecution in JavaDelegate implementations
2. On DelegateExecution in ExecutionListener implementations and on DelegateTask on TaskListener implementations
3. In script task via the execution object
4. When starting a process instance via the runtime service
5. When completing a task
6. When calling the runtimeService.trigger method
Cases 1 - 3 are clear to me. For case 5 there is taskService.complete(taskId, variables, transientVariables);
for case 6 there is runtimeService.trigger(executionId, processVariables, transientVariables);
but there is no runtimeService.startProcess...
method accepting transient variables (RuntimeService javadoc):
Also I did not find a way to set transient variable after I start process and I have
ProcessInstance
object returned by startProcess...
method.
Is there a way to set transient variables when starting process or do I have to use workaround (cases 1 or 2)?
Upvotes: 1
Views: 593
Reputation: 12548
You can set transient variables on start in 6.x by using a slightly different method for starting the process:
runtimeService.createProcessInstanceBuilder()
.processDefinitionKey("transientVarsTest")
.transientVariable("variable", "gotoA")
.start()
Upvotes: 2