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
PmathurPmathur 

Inbound & outbound mails

Hi,

 

I am working on standard object Case. I want to track the number of inbound and outbound emails for cases. How can I track that through code.

 

Thanks

Pmathur

Vinit_KumarVinit_Kumar

Hi,

 

You can't track the outbound emails as it is not stored any where.However,you can track Inbound emails as it is stored in EmailMessage object.You can query on this object as below :-

 

EmailMessage em = [select FromName,HtmlBody from EmailMessage where parentId=<seome case id>];

 

Please go through the belwo link to get all fields on EmailMessage.

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_emailmessage.htm

 

 

PmathurPmathur
Hi Vinit,

Actually I want to count the number of Inbound & Outbound Emails for all Cases. I don't have specific case id to be inserted in where clause of query. Its just like counting Inbound & outbound mails associated with cases only.