+ Start a Discussion
SfdcBlueFishSfdcBlueFish 

Getting QUEUEMEMBERS IN QUEUE........?

Hi friends,

 

 Can u pls help me to get all queuemembers in Queue?

 

 Is there any SOQL query to get this! pls Help me regarding this........

 

 

 Thank U

Sfdcbluefish

 

 

Best Answer chosen by Admin (Salesforce Developers) 
OxeneOxene

Hi SfdcBlueFish,

 

Queue and queue members are managed using two tables in Salesforce, Group and GroupMember. Queues are stored as records in the table Group with 'Type' as "Queue".

The query [Select Id from Group where type='Queue' and Name='Queue Name'] will return the Id of the required queue in the system.

Use this Id of the queue in the query [Select UserOrGroupId From GroupMember where GroupId =:reqdGroupId] to fetch all the users or groups which are members of the required queue.

 

For more information, refer the documentation.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_group.htm 

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_groupmember.htm

All Answers

OxeneOxene

Hi SfdcBlueFish,

 

Queue and queue members are managed using two tables in Salesforce, Group and GroupMember. Queues are stored as records in the table Group with 'Type' as "Queue".

The query [Select Id from Group where type='Queue' and Name='Queue Name'] will return the Id of the required queue in the system.

Use this Id of the queue in the query [Select UserOrGroupId From GroupMember where GroupId =:reqdGroupId] to fetch all the users or groups which are members of the required queue.

 

For more information, refer the documentation.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_group.htm 

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_groupmember.htm

This was selected as the best answer
SfdcBlueFishSfdcBlueFish

Thank u Oxene,

 

   Thank u...............................very much

sbabasbaba

Hi,

 

If the UserOrGroupId in the GroupMember is assigned with public GroupId or Roles instead of the user then how to get the  userId from the public group and roles?

 

how to identify the UserOrGroupId is not a userId? 

 

Thanks

Saleem

HardeepHardeep

1.Put UserOrGroupId in the list

2.Use the String.value function to get the subtring(0,3).

3. If first three letters are '005' then it is a user and if it is '00G' then it is a group.

 

Dnt have time to put the error-free code .If you need that i 'll also provide that today . but little Later

ForceLoverForceLover

HI Everyone,

 

I have a similar requirement as in the post,could someone reply to me

 

I override my standard convert button with a VF page ,which will convert lead to account ,contact,opportunity through controller.i have three roles in my org which are 'salesrep','executive','manager'.I need it should execute (Lead conversion) only when

 

1)  Sales Rep can convert their own leads, and Lead owned by a Queue they are a member of

2) If Sales Rep converts a lead owned by a Queue , then change ownership Contact, Account, Opportunity to Sales Rep user who is converting.

3) Sales Manager and Executive can convert their teams' leads. If a Sales Manager or Executive converts a sales user's Lead, ownership of lead, opportunity, account and contact should remain sales rep

 

i'm using this code

 

 

Database.LeadConvert  lc =newdatabase.LeadConvert();

lc.setLeadId(lead.Id);

 

LeadStatus convertstatus = [select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];

lc.setConvertedStatus(convertStatus.MasterLabel);

 

Database.LeadConvert[] lcArray =newDatabase.LeadConvert[] {lc};

Database.LeadConvertResult[] results = Database.convertLead(lcArray);

 

System.assert(results[0].IsSuccess());

Taha KhanTaha Khan
Hi I have to give all users belong to certain queue.
queue can have public groups and that public group can have role and subordinate.and that role and subordinate can have many users.
can someone provide me the query to get  users from a queue based on this structure.All help is highly appreciated