You need to sign in to do that
Don't have an account?
Vijay Nagarathinam
Unable to save the email in the Activity History
Hi,
Currently, I am using apex code to send an email to a specific user. I want to add the email in the activity history. Is there any way to add the emails to the activity history related list.
Thanks,
Vijay
Currently, I am using apex code to send an email to a specific user. I want to add the email in the activity history. Is there any way to add the emails to the activity history related list.
Messaging.EmailFileAttachment emailFileAttachment = new Messaging.EmailFileAttachment(); emailFileAttachment.setFileName(attachFile.Name); emailFileAttachment.setBody(attachFile.Body); emailFileAttachment.setContentType(attachFile.ContentType); emailFileAttachment.setInline(false); email.setSaveAsActivity(true); email.setReplyTo(Label.From_Address); email.setSubject('Application submitted documents '); email.setHtmlBody('Test'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
Thanks,
Vijay
u need to use setTargetObjectId(targetObjectId) to add email as activity history.
The setTargetObjectId method supports Lead, Contact and User objects only. But I am using custom object to add the email in the history.
Thanks,
Vijay