SOQL to find user part of Queues

Sample SOQLs:

SELECT UserOrGroupId, COUNT( Id ) FROM GroupMember WHERE GroupId IN ( SELECT Id FROM Group WHERE Type = 'Queue' ) GROUP BY UserOrGroupId
 
For User level
SELECT UserOrGroupId, COUNT( Id ) FROM GroupMember WHERE UserOrGroupId = '0055w00000BflFyAAJ' AND GroupId IN ( SELECT Id FROM Group WHERE Type = 'Queue' ) GROUP BY UserOrGroupId 
 
Or use
https://<domain>.my.salesforce.com/_ui/system/user/QueueMembershipPage/d?userId=<User Id>

4 comments:

  1. Hello I am trying to get a list of users that belong either to a Public Group or a Queue, for the moment I have this query that gives in return the ID's o the users. But idk how to get their names too. Any suggestions?
    Thanks!

    ReplyDelete
    Replies
    1. You have to use another query to fetch it from User object.

      Delete
  2. Hey man , i am looking for a query that retrieves all the queue names assigned to a particular user . Any way we can do that ?

    ReplyDelete
    Replies
    1. You can use SELECT GroupId, FROM GroupMember WHERE UserOrGroupId = 'Id of the User'

      Delete