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
benito camelabenito camela 

Ideas Title not displayed in template email

Hi, I have an email template (type:Visualforce) that is sent each time someone comment an Idea.


trigger myIdeas on Idea (after update) {
        for (Idea i : {
			if(i.LastCommentDate > i.LastModifiedDate){
				Id emailId = [SELECT Id FROM EmailTemplate WHERE DeveloperName='New_Ideas_comment'].id;
				String[] toAddresses = new String[] {''}; 

				Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
				mail.setSenderDisplayName('test test');
				mail.saveAsActivity = false;
				Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 ... and my template:

<messaging:emailTemplate subject="The Idea {!relatedTo.title} has a new comment" recipientType="User" relatedToType="Idea">
<messaging:plainTextEmailBody >

Dear {!recipient.FirstName} {!recipient.LastName}



 {!relatedTo.Title} is blank. Do you know what's the problem ?



The crazy thing is that when I use a template of type TEXT, it works !!!


e.g.: Subject: New Comment ({!Idea.NumComments}) on Idea: {!Idea.Title}



benito camelabenito camela

Sorry, but with text email templated I have the same problem, the Ideas fields are not merged. Is this happening because I'm adding a comment and not updating the Idea itself ?