You need to sign in to do that
Don't have an account?
Ab
best way to represent an email sent from apexclass on the opportunity record
Hello,
I am sending an email from an apex class like
This email is sent afer a modification made on opportunity.
When i send email:
I have Body, attachment.
I want this email to be showed on Opportunity.
Can i show this as Task and add it on related list on Opportunity ?
or I add an attachment and say that opportunity is the parent.
thank you in advance for suggestions
I am sending an email from an apex class like
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
This email is sent afer a modification made on opportunity.
When i send email:
I have Body, attachment.
I want this email to be showed on Opportunity.
Can i show this as Task and add it on related list on Opportunity ?
or I add an attachment and say that opportunity is the parent.
thank you in advance for suggestions
If you want to send email and want to show in task and want to add it on related list on Opportunity.
You have to add this line in your code:
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setSaveAsActivity(true);
email.setWhatId(opportunityId);
You can refer to this link to know how to send attachment as an email. But you have to include the lines i have mentioned in the code to save it as task in the related list of opportunity.
https://developer.salesforce.com/forums/?id=906F00000005J1cIAE
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha