AnsweredAssumed Answered

Assign a workflow's task user (initiator)  from Java

Question asked by angello0571 on Sep 11, 2012
Latest reply on Sep 12, 2012 by afaust
Hi!

I'm trying to start a new process instance from Java. First I get the runtime service like this:

RuntimeService runtimeService = null; 
         Map<String, Object> vars = new HashMap<String, Object>();
   vars.put("scwf_ramoName", "Aeronaves");
   ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
   if(config!=null){
      runtimeService = config.getRuntimeService();
                runtimeService.startProcessInstanceByKey("ElaboracionReqSesa",vars);
}
      
And I got this exception:
org.activiti.engine.ActivitiException: Unknown property used in expression

I figured that it is caused because in my workflow definition I have a task with the atribute : activiti:assignee="${initiator.properties.userName}"

Does anybody know how I can create the initiator variable programatically from Java ? Or any body that can guide with a little tip to assign the task to a user from Java?

Thanks in advance!

Outcomes