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
kfm2012kfm2012 

Change Case Owner to a Queue from within Apex Trigger

I have a before insert trigger on the Case object.  Under certain conditions, I need to change the owner of the case to a Queue called 'Platinum'.  I need to set x.Owner = <Platinum Queue>.  I assume i have to run a sql statement to get the ID of the 'Platinum' queue and then set x.owner equal to that?       thanks

Best Answer chosen by Admin (Salesforce Developers) 
jungleeejungleee

Run a SOQL query on the QueueSObject and fetch the id of the Queue by searching on the basis of the name of the Queue. Set ownerid = queue.id; and this should work

 

Regards

Sam

All Answers

jungleeejungleee

Run a SOQL query on the QueueSObject and fetch the id of the Queue by searching on the basis of the name of the Queue. Set ownerid = queue.id; and this should work

 

Regards

Sam

This was selected as the best answer
kfm2012kfm2012

worked.  thx!