How to get user's manager name,info using Groovy script?

I am using below groovy script to get users Manager Name,Email. Using Bonitasoft Studio 6.5

${import org.bonitasoft.engine.IdentityAPI;
import org.bonitasoft.engine.identity.User;
IdentityAPI api = apiAccessor.getIdentityAPI();
User user = api.findUserByUserName(processInstance.getStartedBy());
User manager1 = api.getUserByUUID(user.getManagerUUID());
return manager1.email;
}

What am I doing wrong above?

1 Like