Expand my Community achievements bar.

Clean-up Report: Teams, Groups, Companies with no members

Avatar

Level 3

10/25/23

Thinking this report may have been created by someone already-

 

Report that shows teams, groups, companies with no members towards clean up of unused objects.

(thinking of @RandyRoberts and past amazing clean up report scripts).

Thank You.

8 Comments

Avatar

Community Advisor

10/25/23

I'm flattered

You don't have to worry about teams as you cannot have an empty team.

I've not tried to get a members list for Groups or Companies and members are not listed as collections in the API. Maybe @Doug_Den_Hoed__AtAppStore or @skyehansen or maybe @William-- may know how to get to members from the group or Company object. 

From the user object, it's here:

displayname=All Groups
listdelimiter=
listmethod=nested(userGroups).lists
namekey=group.plural
textmode=true
type=iterate
valuefield=group:name
valueformat=HTML

or Here:

valuefield=companyID
querysort=companyID
valueformat=HTML
linkedname=direct
namekey=companyID

 

Avatar

Community Advisor

10/26/23

Yep, text mode filters below:

Companies with no members:

 

 

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=USER
EXISTS:a:companyID=FIELD:ID

 

 

Append EXISTS:a:isActive=true to the above filter to list companies with no active members.

 

Groups with no (active) members. (Groups require at least 1 member, but that user may not be active in some cases):

 

 

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=USRGPS
EXISTS:a:groupID=FIELD:ID
EXISTS:a:user:isActive=true

 

 


Teams with no (active) members. 

 

 

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=TEAMMB
EXISTS:a:teamID=FIELD:ID
EXISTS:a:user:isActive=true

 

 

In the above Teams filter, you can remove the last line to list teams with no members at all.

Avatar

Level 3

10/31/23

awesome, thanks for the feedback @RandyRoberts and @William-- .  will try this out and let you know if i encounter any issues.

suspect we had a lot of teams setup, and then the members became deactivated.

thanks for the support, love the clean up efforts.

Avatar

Level 3

10/31/23

22 companies with no members.

@William-- 

 

when i try to append companies report 

 

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=USER
EXISTS:a:companyID=FIELD:ID

with:

Append EXISTS:a:user:isActive=true to the above filter to list companies with no active members.

i get a "whoops" something went wrong error.  without the appendage, report runs fine.

Avatar

Community Advisor

10/31/23

@quarkmage 

 

Apologies, for the company filter, you can use the below to show companies with no active members: 

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=USER
EXISTS:a:companyID=FIELD:ID
EXISTS:a:isActive=true