I have one object where i am using one custom field (Queue_Name). I am entering the queue Label in that text field. I need to check wheather we are entering the correct queue Label present in Queues or else error needs to be appear.

Limitation-we cannot create a Queue as a lookup field. Please suggest other option

1 Answer 1


You can

select Id,Name from Group where Type = 'Queue'

Refer this

How do I query queue ID in Apex?

Way 1 : Create custom object 'Custom_Queue__c' and populate name with the help of batch. Then look up this with your custom object. Which will help to prevent type the wrong name.

Way 2 : Put an validation in trigger and query and check the name entered in your custom object is valid.

Way 3: Use both.

  • i just want to prevent users to enter incorrect QueueLabel which is not available in Queus.How to achieve this.Is this possible using validation/workflow?
    – dem
    Dec 8, 2016 at 12:52
  • workflow is not possible. Trigger validation is possible.
    – bharath
    Dec 8, 2016 at 13:04
  • Why is way 2 not advisable vs changing data model. And should never do both. Way 1 should be custom setting and not custom object in most cases
    – Eric
    Dec 8, 2016 at 13:47
  • Agree. Custom setting works instead of custom object.
    – bharath
    Dec 8, 2016 at 13:58

You must log in to answer this question.

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