function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dsh210@lehigh.edudsh210@lehigh.edu 

Select a Queue in Trigger for Case Assignment

Hey All,

 

I apologize if this has already been solved, but it is very difficult to search for since the term 'queue' is so frequent in other uses. 

 

I have a trigger that is creating and assigning cases based off Opportunity action. However, I would like to be able to select and assign the case to a queue. Apex tells me that the SObject Queue is not supported ( [SELECT Id FROM Queue] ), and Queues have no entry in the User Table. 

 

If I know that I want to assign the case to a queue called 'MyQueue', I would like to be able to code that in rather than hardcode the ID. This will ensure that the trigger will work in any org we place it in.

 

Any suggestions are appreciated!

-DH

Best Answer chosen by Admin (Salesforce Developers) 
forecast_is_cloudyforecast_is_cloudy

You can query Queues in Apex. Use the following syntax:

 

Select SobjectType, QueueId, Id From QueueSobject

All Answers

forecast_is_cloudyforecast_is_cloudy

You can query Queues in Apex. Use the following syntax:

 

Select SobjectType, QueueId, Id From QueueSobject

This was selected as the best answer
dsh210@lehigh.edudsh210@lehigh.edu
Great! Thank you so much.
forecast_is_cloudyforecast_is_cloudy

You're very welcome.