You need to sign in to do that
Don't have an account?
SAHG-SFDC
Cancel method in Apex
I have a cancel method in Apex controller which saves even if the user clicks cancel
public PageReference cancelSave() {
return null;
I need the user to stay on the same page when cancel is clicked (Cannot use standard cancel)
public PageReference cancelSave() {
return null;
I need the user to stay on the same page when cancel is clicked (Cannot use standard cancel)
Follow these below links and you will get the logic.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm
public PageReference cancelSave() {
// add your logic here, like the required DML statement (insert /update) of the record you want to save
return null; // this will make the user stay on the same page
}