List plan item instances by query property involvedUser or involvedUserGroup

Hello Team,

Can anyone please help me for one issue.
I am trying to fetch list of plan item instances based on user or group and for that I need to fetch list of IdentityLink like this.
List list = runtime.getIdentityLinksForPlanItemInstance(planItemInstance.getId());

But above list is empty and I think I need to setIdentityLinks for plan item instances, so I tried to set that information using following code snippet.

IdentityLinkUtil.createPlanItemInstanceIdentityLink(instance, “USERNAME”, “USERGROUP”, IdentityLinkType.CANDIDATE);
But, above call is giving me NPE (Null pointer) and stack trance is like this.

at org.flowable.cmmn.engine.impl.util.CommandContextUtil.getIdentityLinkServiceConfiguration(
at org.flowable.cmmn.engine.impl.util.CommandContextUtil.getIdentityLinkService(
at org.flowable.cmmn.engine.impl.util.CommandContextUtil.getIdentityLinkService(

Could you please provide me the best way to do this and share some example?


You would need to call the code above from within a ‘command context’. I.e. you can wrap it in a managementService#executeCommand() call with your own Command.