You need to sign in to do that
Don't have an account?
ravalipothineni1.3549438248976
How to Override "Save and New" Functionality in Standard Edit Page
How to override the"Save and New" Button Functionality which is in Standard Edit Page
Thanks ,
Ravali
Page
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" id="xyzz"/>
<apex:commandButton action="{!Save}" value="Save & New" id="saveAndNew"/>
<apex:param name="newAndSave" value="newAndSave" />
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
Class:
public PageReference save() {
Id id = controller.getId();
controller.save();
Boolean saveAndNew = false;
for(String key : Apexpages.currentPage().getParameters().keySet()){
if(key.contains('saveAndNew')){
saveAndNew = true;
break;
}
}
if(saveAndNew){
Apexpages.currentPage().setRedirect(true);
return new PageReference('/'+controller.getRecord().getSObjectType().getDescribe().getKeyPrefix()+'/e');
}
else
return controller.view();
}