You need to sign in to do that
Don't have an account?

How to send email to Queue members using Messaging.sendEmail
Hi team,
I am trying to send email using Messaging.sendEmail() method using Apex trigger on Case object.
The Owner of the Case object could be single owner or a Queue. How can I send the email address to all the members of the queue when Case owner is a Queue?
I am trying to send email using Messaging.sendEmail() method using Apex trigger on Case object.
The Owner of the Case object could be single owner or a Queue. How can I send the email address to all the members of the queue when Case owner is a Queue?
Greetings!
You can create the list to add all the emails of the members in the queue and then use the Messaging.sendEmail() to send to the list.
Please refer the below sample code:
Reference:https://salesforce.stackexchange.com/questions/129171/send-email-to-queue-members-using-apex
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
I did check the reference link you provided earlier. Thanks for sharing.
However the system allows lot of flexibility while adding queue members in the queue. For example, in my org, the Queue is made of users and groups. The group eventually contains other members in it.
Thus I was looking for some flexible solution. In future if someone makes adjustment to the original queue, my code should be able to handle it!
Regards,
Ankit