+ Start a Discussion
narsavagepnarsavagep 

How do I send email to Queue members when creating/assigning a Case via Apex trigger?

I have Apex script as part of an Opportunity trigger that creates a Case and assigns that Case to a queue.
 
How do I send the queue members an email that the case has been assigned to them?
(I want to mimic the send email functionality that exists in the "Case Assignment Rules", which sends an email when a case is routed to a queue.)
 
Currently I am manually assigning the case to a queue within my Apex trigger.
If the solution would be to create the case and then "fire-off" the auto routing rules, I would be happy to do that, but then my question is "how do I do that?"  :)
 
Thanks,
Paul
tmatthiesentmatthiesen
You should be able to query the Queue members and then construct an outbound email, setting the setTargetObjectIds to the corresponding user ids.
TehNrdTehNrd
http://ideas.salesforce.com/article/show/10094219/Invoke_Assignment_Rules_with_Apex#skin=le

I assume this would follow the regular behavior and send a notification email to the owner or queue members.
narsavagepnarsavagep

Exactly!  Thanks for the "Idea"... I promoted.

TehNrdTehNrd
Thanks!