cancel
Showing results for 
Search instead for 
Did you mean: 

Set process variables before process start

jolo_
Champ on-the-rise
Champ on-the-rise
What I have:
1. Process model that looks like: process_start –> service_task –> ..
2. The process starts in startProcessMethod()


What the problem:
I want to pass objects, that are created in startProcessMethod(), to service_task method.
BUT to put objects into process context I should firstly to start it:

startProcessMethod() {
……..
   Object obj = new Object();
   ProcessInstance newHiringProcess = runtimeService.startProcessInstanceByKey("myProcess");
   newHiringProcess.getProcessVariables().put("obj", obj);
…….
}


Questions:
1. Can I set process variables before process start?
2. If not, how can I pass variables from startProcessMethod() method into service_task?
1 REPLY 1

one87
Champ in-the-making
Champ in-the-making
Are you looking for sth. like this:
<java>
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("username", user.getUsername());
variables.put(…..);
businessProcess.startProcessByKey("sccms", variables);
</java>