You need to sign in to do that
Don't have an account?
Anupama@28
Apex Controller - Compare old and new values
Hi,
I have a method in a controller, which takes to the edit page of a contact where user can edit the contact and save.
How do i compare the old and new values of that contact ?
apex Controller
==============
public pageReference gotoContactEditPage()
{
PageReference conEditPage = new PageReference('/' + contactId+ '/e');
conEditPage.setRedirect(true);
// Here i want to compare the old and new values of contact (before save and after save)
return conEditPage
}
I have a method in a controller, which takes to the edit page of a contact where user can edit the contact and save.
How do i compare the old and new values of that contact ?
apex Controller
==============
public pageReference gotoContactEditPage()
{
PageReference conEditPage = new PageReference('/' + contactId+ '/e');
conEditPage.setRedirect(true);
// Here i want to compare the old and new values of contact (before save and after save)
return conEditPage
}
Here you will get saved contact, Now compare with edited one.
NOTE: Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
With SOQl query in the method i can get old values not new .
public pageReference gotoContactEditPage()
{
PageReference conEditPage = new PageReference('/' + contactId+ '/e');
conEditPage.setRedirect(true);
// As soon as the standard contact edit page opens, the below query fetches the old values not new ones
Contact con = [Select name from contact where id=:contactId]
return conEditPage;
}