How to claim a user task and assign to a user

Showing results for 
Search instead for 
Did you mean: 
Member II

How to claim a user task and assign to a user

I am developing spring boot app with Activiti 7. when I submit a request,processInstace start the BPMN flow, trying to assign a task to user and then user can process the request. How to assign a task to a user?

Here is my sample code:

Configuration class:

public void configure(AuthenticationManagerBuilder auth) throws Exception {

public UserDetailsService myUserDetailsService() {
InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserDetailsManager();

String[][] usersGroupsAndRoles = {
{"user1", "password", "ROLE_ACTIVITI_USER", "GROUP_activitiTeam"},
{"other", "password", "ROLE_ACTIVITI_USER", "GROUP_otherTeam"},
{"admin", "password", "ROLE_ACTIVITI_USER", "GROUP_activitiTeam"},

for (String[] user : usersGroupsAndRoles) {
List<String> authoritiesStrings = Arrays.asList(Arrays.copyOfRange(user, 2, user.length));"> Registering new user: " + user[0] + " with the following Authorities[" + authoritiesStrings + "]");
inMemoryUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), -> new SimpleGrantedAuthority(s)).collect(Collectors.toList())));
return inMemoryUserDetailsManager;

service class:

public ProcessInstance startProcessInstance(AccessRequest request) {
ProcessInstance instance= processRuntime.start(ProcessPayloadBuilder

List<org.activiti.engine.task.Task> tasks = taskService.createTaskQuery().processInstanceId(instance.getId()).list();
return instance;


public class AccessRequest {

private String formId;

private String formName;

public String getFormId() {
return formId;

public void setFormId(String formId) {
this.formId = formId;

public String getFormName() {
return formName;

public void setFormName(String formName) {
this.formName = formName;

Here is my user task in xml

<userTask id="UserTask_1" activiti:exclusive="true" activiti:assignee="" name="User Task 1">

how to assign the assignee name here?

I am trying to call from postman and run "StartProcessInstance" then claim the task and complete the task.