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
sravikasravika 

Auto-populate the case comments on case object after sending an email

Hello everyone,

 

 My requirement is. "I am creating a custom button "Send an E-mail" on CASE object. On click of the button, e-mail is being sent to the User with the required template. Template and everything is written in Apex. The template also contains some dynamically entered values on the VF page(in which the "Send an e-mail" button is present).

 

After sending an email the "Case Comments" related list of CASE object should be auto-populated with the details of the sent mail.(like to,cc,body of the email).

 

Please help me in this issue.

Thanks in advance.

 

 

 

Regards,

Sravika.

 

 

ForceMantis (Amit Jain)ForceMantis (Amit Jain)
Try this
SingleEmailMessage message = new SingleEmailMessage();
message.setSaveAsActivity(true);

If this doesn't work you will need to write apex code in your custom page to insert data in CaseComment object.

sravikasravika

 

Hi Amit,

 

I have tried with the solution u mentioned. But i was not able to get it.

Could you please give me an idea of how to write the apex code for the auto-populating of case-comments related list.

 

 

 

Regards,

Sravika