+ Start a Discussion
SFDCExplorerSFDCExplorer 

Trigger on EmailMessge object

Is it possible to write a trigger on EmailMessage object? I would like to track count of the emials that have been sent from salesforce.

Thanks In Advance.
Best Answer chosen by SFDCExplorer
Nagendra Prasad ChNagendra Prasad Ch
Yes it is possible.
trigger EmailMessageTrigger on EmailMessage (after insert,before insert) {
for(EmailMessage msg : trigger.new){

}
}

Refer to this link for more info;
https://developer.salesforce.com/blogs/developer-relations/2009/10/one-of-the-things-about-working-for-a-company-that-innovates-at-such-an-incredible-pace-is-that-you-are-constantly-tasked-wit.html

All Answers

Nagendra Prasad ChNagendra Prasad Ch
Yes it is possible.
trigger EmailMessageTrigger on EmailMessage (after insert,before insert) {
for(EmailMessage msg : trigger.new){

}
}

Refer to this link for more info;
https://developer.salesforce.com/blogs/developer-relations/2009/10/one-of-the-things-about-working-for-a-company-that-innovates-at-such-an-incredible-pace-is-that-you-are-constantly-tasked-wit.html
This was selected as the best answer
Mehul MakwanaMehul Makwana
Hi SFDCExplorer,

The only method to get an accurate count is to run an email log.  Setup > Adminstration Setup > Monitoring > Email Log files.

Every email sent from the system counts no matter where they orginate from, users, workflows, alerts.

Let me know If it me Know.
SFDCExplorerSFDCExplorer
@ Nagendhra Prasadh, Ratan & Salesforce MM
Thank you so much for your response. 

Is it possible to create a report that shows how many emails have been sent by case owner on hourly basis? 

Any Suggestion Welcome.