I'm creating a task like this,
ProcessInstance processInstance = runtimeService
.startProcessInstanceByKey(ApplicationConstants.POST_APPROVAL_WORKFLOW_NAME, variablesMap);
I want to assign the owner for this, how can I do it.
If not, is it possible to find taskId from this then I can use taskService.setOwner.
Please help me with this.
Ok, obviously you are new to Activiti and workflow in general.
You are not directly creating a task, rather, you are creating a process instance based on the workflow definition ApplicationConstants.POST_APPROVAL_WORKFLOW_NAME.
This process instance may include user tasks which show up over time.
To retrieve all current tasks for a given process instance you can use the TaskService to retrieve the tasks from the process instance ID returned by your start command.
Once you have the process Instance:
List<Task> tasks = taskService.createTaskQuery().processInstanceId(pid).list()
This will return a list of tasks.
More details can be found in the Java API here.
Cheers,
greg
bp3
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.