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
vibrationvibration 

how to insert a activity history, in when i send a mail?

how to insert a activity history, in when i send a mail?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

Try this :

 

SingleEmailMessage message = new SingleEmailMessage();
message.setSaveAsActivity(true);

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Try this :

 

SingleEmailMessage message = new SingleEmailMessage();
message.setSaveAsActivity(true);

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
vibrationvibration
thanks
nduchnduch

HI Ankit,

your solution does not work for me.

I think that message.setSaveAsActivity(true); only activates the functionality, but then you have to create a new ActivityHistory object with all the fields (Date, etc.) in the code and/or insert it into the DB. Is that correct?

 

Many thanks!