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
Peter2mPeter2m 

Save Email created with email template on opportunity

Save Email created with email template on opportunity - I use trigger on lineitem that calls a class to send email.

In that class i want to save the email to opportunity as attachment. I need this so the salesrep can edit the sent mail and resend the mail, if something is missing.  Please need help.

virtcoudvirtcoud

You'd need something like this:

 

Attachment attachment = new Attachment(Name='An attachment',body=Blob.valueOf(YOUREMAIL.textbody);,parentId=YOUROPPID);
insert attachment;