2

Is there a way to query only queues tied to a particular sobject?

I have the following query which gets me all the queues.

Select id, name from group where Type = 'Queue'

I want all queues which are tied only to sobject : CustomObject__C. How can I modify the above query or is there a better approach?

2 Answers 2

7

There is a QueueSobject from which you will get the queues along with the object assigned to it.

Please check the below query:

SELECT QueueId, Queue.Name, SobjectType FROM QueueSobject WHERE SobjectType = 'CustomObject__C'
5

You can use QueueSobject for this. QueueSobject represents the mapping between a queue Group and the sObject types associated with the queue, including custom objects.

Sample query:

 QueueSobject que = [Select Id, SobjectType, QueueId, Queue.Name from 
 QueueSobject where SobjectType = 'Case']; 

You must log in to answer this question.

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