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
venkat rvenkat r 

Restricting Number of Users in a Queue

Is there a way to restrict the number of users in a queue. 
NagaNaga (Salesforce Developers) 
Hi Venkat,

Groups are sets of users. They can contain individual users as well as other groups, the users in a particular role or territory, or the users in a particular role or territory plus all of the users below that role or territory in the hierarchy. 

From the above, depending on how your Queue is defined, just creating a new User with a specific Role, could cause a user to be added to your Queue. I see nothing in the Object Reference that would allow you to limit the size of a Queue or Group. 

Since the supported calls for Group are create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), search(), retrieve(), update() and upsert(), I see no reason you couldn't write a trigger on Group to detect when a new user has been added to your queue. 

A related object you may want to be aware of is the QueueSobject which represents the mapping between a queue Group and the sObject types associated with the queue, including custom objects. Its essentially a Map that links the QueueId to the associated sObjectType.

Best Regards
Kiran
venkat rvenkat r
Hi Kiran Thanks for the response and explanation. I have just started working in salesforce. If a trigger is allowed on the Group object, why would it not allow me to restrict users using a before insert trigger. Thanks Venkat