Hello.
I am trying to implement a custom execution listener where I need to set a collection of users that is going to be used in a multi-instance task.
Below all the ways I tried in order to get information I need:
IdmIdentityService identityService = CommandContextUtil.getIdmIdentityService();
identityService.createUserQuery().userId("admin").singleResult();
identityService.createUserQuery().memberOfGroup("COMITE_CREDITO_PA").list();
I also tried with:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
IdentityService identityService = processEngine.getIdentityService();
identityService.createUserQuery().userId("admin").singleResult();
identityService.createUserQuery().memberOfGroup("COMITE_CREDITO_PA").list();
In both cases the result is null.
Is there anything I am doing wrong?
Edit: I am using the idea described at How to access to user information in script Task - #2 by martin.grofcik
In the other case use identity service to query for the user info. In the context of script task you can use
org.flowable.engine.impl.util.CommandContextUtil
to get any service you want.