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
❤Code❤Code 

dynamic email template

Hi All,

I have a requirement where i have a custom object O1 which is having field f1, f2, f3, f4 and I have an email template. When ever a field value is changed i would like to trigger an emailtemplate stating "(f1.OldValue) has been changed to (f1.NewValue)" of that field only. And if there are no change in other fields then the mentioned statement shouldn't appear.
Can anyone tell me the approach.

Regards
 
AshwaniAshwani
First approach is you can user Visualforce Email Templete. There you will have option to set page design as per your need.

Second you can create email templetes you want and by code you can provide Id of email templte when sending email to decide the template.
Suneel#8Suneel#8
I don't think you can get old value of the field in email templates. I guess you can achieve this by setting the body of it manually in trigger and not using template
Suneel#8Suneel#8
You can check out this link - https://krishhari.wordpress.com/2013/09/03/dynamically-populating-custom-html-email-template-content-in-force-com-with-custom-dynamic-data-using-apex/  Hope it helps