Hey Everyone,
I am facing an issue while getting the groups for a user.
We used to make use of function getgroupsformemberuser() from plugin People function version 1.10 jar
We need to update the People function plugin to 1.16.0 jar but in this newest update, getgroupsformemberuser() is not supported.
Replacement for getgroupsformemberuser() function looked a!groupsForUser() but result set of both is not matching.
When I use getgroupsformemberuser(), I get 70 groups list which is absolutely perfect.
When I match with the number of groups for loggedInUser from Users in Appian: It shows 70 users
Means, getgroupsformemberuser() output matches with actual groups.
But when I use a!groupsForUser() appian built in function, it return 72 groups:
Conclusion: Output is not matching as it's returning 2 more groups which I don't have permission to view.
Is there any way that these 2 extra [NO PERMISSION] groups can be removed from this result set? Issue is that these 2 extra values are of group type and not null or empty otherwise it would have been easy to remove these extra 2 values.
Or is there any other way of achieving the functionality of getgroupsformemberuser()?
Discussion posts and replies are publicly visible
I would recommend sticking with a!groupsForUser(), and I'm sure we can filter those out. Assuming those groups have a securityMapName of "Personal"? Run this in your environment to verify (assuming it allows you to call fn!group() properties in your context) - from there you can make a filtering rule to use with fn!reject().
a!localVariables( local!groups: a!groupsForUser( username: loggedInUser(), isGroupAdministrator: false ), a!forEach( items: local!groups, expression: group(fv!item,"securityMapName") ) )
It's not allowing us to access the property "securityMapName" for the same 2 groups and gives us this error:
Seems there is some permission issue. Please check the visibility and privacy settings of the group.
I guess that would be expected as your context cannot see the group itself.
Let's try this, if tostring() converts the restricted groups differently, we could remove them easily - what do see when you run the following:
a!localVariables( local!groups: a!groupsForUser( username: loggedInUser(), isGroupAdministrator: false ), a!forEach( items: local!groups, expression: tostring(fv!item) ) )
Seems to be related with permissions... According to documentation, the function has two more parameters, did you try with them?
My understanding here is that the groups in question are setup with a security map of Personal, and the OP is not an administrator of the group or system, so their context cannot see or do anything with the group (including update it's security map).
a!groupsForUser() is returning placeholders for these as "[NO PERMISSION]" (where the prior plugin did not), and we want to remove those from the list. Since the OP's context cannot see fn!group() settings to filter on them, I'm wondering if converting tostring() will return something like "[NO PERMISSION]", instead of the standard "[Group:189]", and allow crude filtering out via the text values. I do not have an easy way to test this locally, as a system admin.
Chris At first I also tried the same but it does not return a text string like "NO PERMISSION" otherwise we could have filtered out based on this text string.
It actually returns "[GROUP: 5]"