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

Overriding "Save & New" button on Opportunity edit page
Hi,
I need to override "Save & New" button on Opportunity edit page. But, there should not be any change in the "New" button on Object Home Page in terms of functionality.
Either "Save & New" needs be removed or it should not allow creating new records.
Any idea how to go about it??
Please help.. Thanks in Advance,
Suvra
Maybe create your own opportunity edit page, and then define your buttons there.
then override the standard edit button with this page.
Thanks for your ideas..
Hi,
This may help: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=32238
If you want to override the save and new then use the variable 'save_new' in the URL ie add 'save_new=<call page/s-control/file>' to your URL
Following is generic code uses Standard Save functionality for any object object.
<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>
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();
}
Your solution worked for me.Thanks:)
Thanks
Jay
Hi
Using Master Lookup we can solve this problem.
Thsnk you