I would like to use a custom VF page for the record type selection page for new Opportunities but after that, I want the standard new/edit page to be displayed.

I have the custom VF page set to override the "New" button on the Opportunity but when I push to "/600/e" (the new Op page) from my custom controller, I get pushed back to my own VF page.

Is there a way I can push to the new/edit page instead of getting stuck in a loop?

Note: I have confirmed the VF page works as expected when it is not overriding the "New" button.


System.PageReference pageReference = new System.PageReference('/006/e');
return pageReference;
  • 1
    can you share your VF code, most likely u need to adjust your saveURL and retURL params. – Rao Feb 13 '14 at 17:39
  • I have added the code I use to try to redirect to the New Op page. – Haphazard Feb 13 '14 at 18:03

To avoid the spurious save, you can add RecordType and nooverride parameters to the '/006/e' URL. See my blog post here for a related but slightly different use case that includes some code. This assumes all you are passing from your custom page to the normal page is the selected record type.

You simply add this to your PageReference: pageReference.getParameters().put('nooverride', '1');

| improve this answer | |

After saving, you need to have your VF page navigate to the standard 'edit' URL. (Going to the '/600/e' is actually telling SFDC that you want to create another Opportunity.)

insert opp;
return new PageReference('/' + opp.Id + '/e');
| improve this answer | |
  • I would rather not have to save the record first. Is there a way around that? – Haphazard Feb 13 '14 at 18:02
  • Hmmm, I think Keith's answer would allow that. You would need to make sure you query for the record type and pass in the parameters correctly. His solution is a little more complicated than you need but it should still work. – dphil Feb 13 '14 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.