Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

Code:

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

2 Answers 2

up vote 1 down vote accepted

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');

share|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');
share|improve this answer
    
I would rather not have to save the record first. Is there a way around that? –  Haphazard Feb 13 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 at 18:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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