In my Appian environment, I’ve noticed that some groups have UUIDs that start with SYSTEM_GROUP_ followed by the group name, instead of the usual alphanumeric UUID format.How can I logically identify or classify these groups separately from regular groups?
SYSTEM_GROUP_
When I use scimGetGroup() on these SYSTEM_GROUP_ groups, it doesn’t return any group attributes, unlike the other groups with standard UUIDs.Is this expected behavior? And is there a workaround to retrieve attributes for these system groups?
scimGetGroup()
Discussion posts and replies are publicly visible
It is possible to retrieve the UUID via the getgroupuuid in the People Functions. A very simple solution is to do a forEach in combination with a like to identify anything that starts with SYSTEM_GROUP_.
I also wrote an in depth blog post on a better way to query groups which might be helpful: https://blog.appiandevs.io/005-a-better-way-to-work-with-groups-in-appian-part-3/
Using this method I can easily query for this:
sanjuktab2257 said:How can I logically identify or classify these groups separately from regular groups?
I have added logic to the code. Have a look at it.
sanjuktab2257 said:Is this expected behavior?
Yes
sanjuktab2257 said:And is there a workaround to retrieve attributes for these system groups?
I have added logic to the code. Have a look at it.a!localVariables( local!allGroups: a!groupsForUser(username: loggedInUser()), local!groupData: a!forEach( items: local!allGroups, expression: a!map( group: fv!item, uuid: getgroupuuid(fv!item), isSystemGroup: a!startsWith(getgroupuuid(fv!item), "SYSTEM_GROUP_") ) ), a!map( allGroups: local!allGroups, systemGroups: index( local!groupData.group, wherecontains(true, local!groupData.isSystemGroup), {} ), regularGroups: index( local!groupData.group, wherecontains(false, local!groupData.isSystemGroup), {} ), systemGroupUUIDs: index( local!groupData.uuid, wherecontains(true, local!groupData.isSystemGroup), {} ), regularGroupUUIDs: index( local!groupData.uuid, wherecontains(false, local!groupData.isSystemGroup), {} ), groupAttribute: a!forEach( items: local!allGroups, expression: group(groupId: fv!item, property: "groupName") ) ) )
a!localVariables( local!allGroups: a!groupsForUser(username: loggedInUser()), local!groupData: a!forEach( items: local!allGroups, expression: a!map( group: fv!item, uuid: getgroupuuid(fv!item), isSystemGroup: a!startsWith(getgroupuuid(fv!item), "SYSTEM_GROUP_") ) ), a!map( allGroups: local!allGroups, systemGroups: index( local!groupData.group, wherecontains(true, local!groupData.isSystemGroup), {} ), regularGroups: index( local!groupData.group, wherecontains(false, local!groupData.isSystemGroup), {} ), systemGroupUUIDs: index( local!groupData.uuid, wherecontains(true, local!groupData.isSystemGroup), {} ), regularGroupUUIDs: index( local!groupData.uuid, wherecontains(false, local!groupData.isSystemGroup), {} ), groupAttribute: a!forEach( items: local!allGroups, expression: group(groupId: fv!item, property: "groupName") ) ) )
I would not directly use system groups in your scenario. Did you consider to create a child groups and use these instead?
Ideally those system groups should not be directly used in any application. Yet to answer your question, please see the below code
a!localVariables( local!allGroups: a!groupsForUser(username: loggedInUser()), /*To find and classify system groups from regular groups - This returns 1 for system groups and 0 for regular ones*/ local!systemGroupIndexes: a!foreach( local!allGroups, find("SYSTEM_GROUP", getgroupuuid(fv!item)) ), /* To retrieve group attributes no special code or changes are needed just pass the group object*/ a!foreach( local!allGroups, group(fv!item, "groupName"), ) /*To get all the system groups in one variable*/ /*index(local!allGroups,wherecontains(1,local!systemGroupIndexes),{})*/ )