Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Salesforce supports sending Email under Activity History on Opportunities/Accounts etc.

Where is this information stored?

Is there a way to send, query and store email messages via the API? The EmailMessage Object documentation suggests it should be possible on the SOAP API.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Firstly, this is not writeable, except by the system as the result of an activity happening.

So when you generate email through some "natural" means, and it stores an activity, the system writes to an object called Activity History. This object has absolutely no direct access.

So this query is illegal:

select Id from ActivityHistory

It returns the error:

entity type ActivityHistory does not support query

But, you can get query access to it as the child relationship of a primary object. For instance, I could do this query:

Select Name, (Select Subject,ActivityType from ActivityHistories) from Account

This you could do with standard SOAP API functionality.

Writing to it directly still remains impossible. Still, any call you do to the sendEmail functionality should be recorded in an object's Activity history, which is, for all intents and purposes "writing to it".

share|improve this answer
Thanks for the correction, Metadaddy! –  Peter Feb 12 '13 at 12:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.