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
CharlieLangCharlieLang 

Stop case being assigned to a queue

I have a validation rule at the moment that stops anyone that is not an administrator changing the owner ID of a case. 

 

AND(ISCHANGED( OwnerId ), $Profile.Name <> "System Administrator")

 

I need to modify this so that users can only re-assign cases to users and not queues. Does anyone know how this is done?

Best Answer chosen by Admin (Salesforce Developers) 
matermortsmatermorts

User Id's always begin with "005" and queue Id's always begin with "00G", so you could try adding a BEGINS clause to your argument.

 

AND(ISCHANGED( OwnerId ), BEGINS(OwnerId, "00G"), $Profile.Name <> "System Administrator")

All Answers

matermortsmatermorts

User Id's always begin with "005" and queue Id's always begin with "00G", so you could try adding a BEGINS clause to your argument.

 

AND(ISCHANGED( OwnerId ), BEGINS(OwnerId, "00G"), $Profile.Name <> "System Administrator")

This was selected as the best answer
CharlieLangCharlieLang

Do you know if there is a way of limiting the validation rule further so that a user could only transfer a case to a user in the same queue as them, if they were to try and transfer the case to a person outside of their queue it would create an error.

matermortsmatermorts
To my knowledge, this isn't possible with a declarative validation rule. I sure would like to know if it is possible though. I'm sure it's possible through apex, but this would be above my skill level.