You need to sign in to do that
Don't have an account?
SingleEmailMessage - saves as Activity, but not as EmailMessage?
I am running a Apex trigger on the Case object that sends an email. The Apex trigger is required as workflow rules to not meet some specific requirements that I have.
The snippet below associates the email to the Contact + Case. I can see the activity associated with both objects. However, on the case, the email does not show under the "Emails" related list. (Apex Explorer confirms that an EmailMessage is not created for the outbound email.) Is there a way to force the save of an EmailMessage record?
system.debug ('contact: ' + Trigger.new[0].ContactId);system.debug ('id : ' + Trigger.new[0].id);mail.setTargetObjectId(Trigger.new[0].ContactId);mail.setWhatId(Trigger.new[0].id);mail.setSaveAsActivity(True);