0

I'm looking for a query to find public groups that have no users assigned to them and delete them. It's a large set of data so it would be much easier this way rather than going through all of them.

Thanks!

2
  • 2
    What have you tried? Where are you stuck? Edit your question to add that information.
    – Derek F
    Jan 18, 2022 at 12:17
  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! As Derek sugggests, please edit your question to add what you have tried (it's OK if it fails) and how it is not working (e.g., exact error text). This site exists to help, not do the work. (From the What topics can I ask about here? section of Help Center: "We’re not a place to exchange code or find implementation services.") Please read more of the Help Center, and also take the Tour.
    – Moonpie
    Jan 18, 2022 at 12:21

1 Answer 1

-1
SELECT COUNT(UserOrGroupId) 
FROM GroupMember
WHERE GroupId IN (
    SELECT Id 
    FROM Group 
    WHERE Name = '**Group Label**'
)

Not the answer you're looking for? Browse other questions tagged .