+ Start a Discussion
Bard09Bard09 

Email Template-- Show Previous/Trigger.old data?

Hey all,

 

Is there a way to display previous change data for fields on a Visualforce e-mail template, similar to Apex's trigger.old?

 

Eg "The Opportunity name has changed.  Old value: XYZ.  New Value: ABC".

 

I know I can 100% do this by coding the e-mail template in Apex-- but I really would prefer to write these sorts of e-mails with Visualforce if at all possible.

 

If anyone knows anything, it would be MUCH appreciated.

 

Thanks!

 

Best Answer chosen by Admin (Salesforce Developers) 
Bard09Bard09

I ultimately went down the rabbit hole and implemented the necessary notifications in Apex.  It's a PITA having to manage HTML templates there, but it gets the job done.

All Answers

Bard09Bard09

Anyone?  :)

BA_AdminBA_Admin

if you just want to show the old and new values you can even create a dummy field and do it by work flow rule, just create a field called Opp Name (old) and in the WFR select formula

ISCHANGED(Name) then field update new field__c with formula PRIORVALUE(Name)

 

hope this helps

Glenn WeinsteinGlenn Weinstein

I wish there was native support for this.  It's a common pattern (an email alert when something has changed, to show the old & new values.)

Bard09Bard09

I ultimately went down the rabbit hole and implemented the necessary notifications in Apex.  It's a PITA having to manage HTML templates there, but it gets the job done.

This was selected as the best answer
Glenn WeinsteinGlenn Weinstein

Good to know.  Like you, I know it could be done that way, but hesitant to write a bunch of code for what could be a configuration item.