You need to sign in to do that
Don't have an account?

How to get old values and new vales in Apex class when field changes.
Hi All,
I need to send email when the filed is changed to the record owner with old values and new value in the template.
It should be a class with out using trigger.
Can any one provide with the code.
Thanks in advance.
I need to send email when the filed is changed to the record owner with old values and new value in the template.
It should be a class with out using trigger.
Can any one provide with the code.
Thanks in advance.
May I suggest you please find the below explanation with a similar requirement.
Below is a gist
(https://gist.github.com/brianmfear/b147b7eca2ff7bb2736635cd3bef4e17) that demonstrates how to detect changes from between when the page loads and the edits a user makes. The main feature is that you need to clone the original object, and then you can compare the differences in your save method. The above code primarily demonstrates how a single record could be loaded by two different users, and each could edit separate field values without clobbering each other's edits. Realistically, I'd expect some modification to be required for other purposes, such as the OP, but the concept is similar.
Hope this helps.
Please mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
This trigger is designed to send an email when a field is changed...You just have to change the object and field names, I will highlight the important bits. It works by getting triggered when a field is changed and then uses an email handler to send the email.
Email handler class:
Trigger: hope it helps.
Please mark it as best answer if the information is informative.
Thanks
Rahul Kumar