You need to sign in to do that
Don't have an account?
Terence Viban
EmailTemplate problem
Hi all,
when i modify an existing visualforce email template, the changes are applied on the UI. Now if i query for email template like this
SELECT id, Body, HtmlValue, Name, DeveloperName, LastUsedDate, CreatedDate, Markup, ApiVersion FROM EmailTemplate WHERE Name = 'QuoteVFTemplate'
the HtmlValue returned is unchanged. However the Markup reflects the changes I made to the template on the UI.
Can someone please tell me why this could be happening or point me to the right resource? Haven't been able to find any documentation around caching of Email templates.
The use case is, I want to get the HtmlValue of the template and render it on a Visualforce Page as pdf.
Thank you
when i modify an existing visualforce email template, the changes are applied on the UI. Now if i query for email template like this
SELECT id, Body, HtmlValue, Name, DeveloperName, LastUsedDate, CreatedDate, Markup, ApiVersion FROM EmailTemplate WHERE Name = 'QuoteVFTemplate'
the HtmlValue returned is unchanged. However the Markup reflects the changes I made to the template on the UI.
Can someone please tell me why this could be happening or point me to the right resource? Haven't been able to find any documentation around caching of Email templates.
The use case is, I want to get the HtmlValue of the template and render it on a Visualforce Page as pdf.
Thank you
you can use this to find out htmlbody :
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses('test@gmail.com');
mail.setTargetObjectId('contactid');//Contact id
mail.setTemplateId(selTemplateId);//Template id
Savepoint sp = Database.setSavepoint();
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
system.debug('### Body :'+mail.getHtmlBody()+'=='+mail.getPlainTextBody());
Database.rollback(sp);
All Answers
you can use this to find out htmlbody :
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses('test@gmail.com');
mail.setTargetObjectId('contactid');//Contact id
mail.setTemplateId(selTemplateId);//Template id
Savepoint sp = Database.setSavepoint();
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
system.debug('### Body :'+mail.getHtmlBody()+'=='+mail.getPlainTextBody());
Database.rollback(sp);
Once more thanks for your suggestion