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
Banwari kevat1Banwari kevat1 

Send Email to case record followers when case record update

Hi,
    I required to send email to all follower of a case record when this case record is updated by some one else.
Suppose that i have followed  a case record R1 which created by other user. If R1 record owner update that record then i want to receive an email regarding what has been updated for record R1 which followed by me.

For this, i thought to create update trigger on case but problem is that how to get all followers of that case record.

Thanks.
Best Answer chosen by Banwari kevat1
vishnu Rvishnu R
hi,

To get the followers who are following other users,cases .....you can do like this..

samplequery=[select id,ParentId,SubscriberId from EntitySubscription  ] ;

ParentId->>>>>ID of the record or user which the user is following.
SubscriberId ->>>> ID of the User who is following the record or user.

so by the subscriberId you can fetch the user email and ad it to the sendto of single email messaging...

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_entitysubscription.htm

hope this helps you..
mark it as best answer if it resoved your issue...

Thanks

Vishnu R

All Answers

vishnu Rvishnu R
hi,

To get the followers who are following other users,cases .....you can do like this..

samplequery=[select id,ParentId,SubscriberId from EntitySubscription  ] ;

ParentId->>>>>ID of the record or user which the user is following.
SubscriberId ->>>> ID of the User who is following the record or user.

so by the subscriberId you can fetch the user email and ad it to the sendto of single email messaging...

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_entitysubscription.htm

hope this helps you..
mark it as best answer if it resoved your issue...

Thanks

Vishnu R
This was selected as the best answer
Banwari kevat1Banwari kevat1
Hello vishnu,
   Thanks for giving me a correct solution for what i was trying to do. But now i need to it without trigger can you sugges me some possible how can i carry out theses task without apex trigger.
Thanks in advance.

Regards
Banwari kevat