Pb with UserMembership getgroupParentPath

Hi guys,

software used: 6.3.2 developer license.

Context: building a customer ActorFilter.

I get the list of group for the processiInitiator and want to navigate up its group hierarchy.

long processInitiator = getAPIAccessor().getProcessAPI().getProcessInstance(processInstanceId).getStartedBy();
for (final UserMembership group : getAPIAccessor().getIdentityAPI().getUserMemberships(userId,0,100,UserMembershipCriterion.GROUP_NAME_ASC)) {
LOGGER.info("INFO: group Membership: group.getGroupName():: " + group.getGroupName());
LOGGER.info("NFO: group Membership: goup path :: group.getGroupParentPath() :: " + group.getGroupParentPath());
}

The method getGroupParentPath is always returning null, I was expecting it would return me the path to the parent group of the current group.

Can someone help?

Thanks in advance

Johann

ok,

thanks a lot for the feedback, I will track it.

Would you have an idea to circumvent this problem? How can I get the parent group?

Thanks

Johann

Hi,

Here is the solution I have implemented:
UserMembership group =getAPIAccessor().getIdentityAPI().getUserMemberships(userId,0,100,UserMembershipCriterion.GROUP_NAME_ASC) ;
Group r_group = getAPIAccessor().getIdentityAPI().getGroup(group.getGroupId()) ;
String path = r_group.getParentPath() ;

It is working fine.

Thanks haris & yannick(56?), your feedback was much appreciated

Johann

Sorry if you did already - but did you test it with a user that belongs to a group that has a parent group? Does group.getGroupName() give you expected value in the log?

Hi,

You name your variable processInitiator and after you use userId. Is it the same id with different name ?

Did you create this script in a Human task or a Script Task ?

Hi sorry for the mistake in cut and past when opening the discussion, you can consider userid is properly populated. I get the right groupid but can’t get its parent path.
yes the group has a parent.

i am coding an Actor Filter which is associated with a humantask.

Cheers

johann

You are right, it returns null, it seems to be an issue that you should report (or open a case on the customer portal, if you are a customer).

A quick idea would be do a substring of the user’s group and to remove one level (if his group is mainorg/parent/hisgroup that you remove last slash and everything behind to get mainorg/parent)