You need to sign in to do that
Don't have an account?
How to get the Roles from Queue using Apex
I have queue,See below screen.

and in the queue i have role, now i need to get the users based on that role ,please help me
I tried like below

but in the queue i have role not group i am getting the Group id(Please check the prefix of userorGroupid ,it's staring with 00G(Prefix of group)).Please help me to get the Roles from Queue,thanks in advance.
and in the queue i have role, now i need to get the users based on that role ,please help me
I tried like below
select Id, type from Group where type='Queue' AND Name='Customer Service Director'and see the result below
Select Id,UserOrGroupId,GroupId,Group.type,Group.relatedid From GroupMember where GroupId='QueueId'
but in the queue i have role not group i am getting the Group id(Please check the prefix of userorGroupid ,it's staring with 00G(Prefix of group)).Please help me to get the Roles from Queue,thanks in advance.
we can get the list of users with role names from the queue. try this one..it may help you..
SELECT UserRole.Name,Id,Name FROM user WHERE id IN
( SELECT userOrGroupId FROM groupmember WHERE groupId ='Queue Id' )
ORDER BY
UserRole.name
Thank you,
Anil
SELECT Group.Name FROM GroupMember WHERE UserOrGroupId = 'YOUR-USER-ID' AND Group.Type = 'Queue'
If you want to check if a user is a member of a specific Queue then you can use the following query and if it returns null then they are not a member of that queue.
SELECT Group.Name FROM GroupMember WHERE UserOrGroupId = 'YOUR-USER-ID' AND Group.Type = 'Queue' AND Group.Name = 'YOUR-QUEUE-NAME'