cancel
Showing results for 
Search instead for 
Did you mean: 

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

angello0571
Champ on-the-rise
Champ on-the-rise
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!
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

is there a particular reason you attempt to start a workflow directly via Activiti API instead of the Alfresco API? If you use the Alfresco WorkflowService or workflow action, you would not need to initiate the initiator variable yourself as this is already done by the service.

Regards
Axel