function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Veronika IvhedVeronika Ivhed 

Redirect to VF page on save opportunity. Record type selection is shown twice.

Hi, 

I am trying to override the New button on Opportunity with the following Visualforce Page: 

<apex:page standardController="Opportunity">
<script>
window.top.location.replace("{!URLFOR($Action.Opportunity.New, null, [saveURL='/apex/RedirectToCompetitorAgreement',nooverride=1,save=1], true)}");
</script>
</apex:page>

When the user has entered the opportunity information and presses save he is redirected to the VF page "RedirectToCompetitorAgreement". Everything works as expected except that the record type selection page is shown two times. Any ideas on how I can fix this issue? 
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Veronika,

Use retUrl to return your desired location, as below line is leads to opportunity detail page.
​retURL=%2F+{!opportunity.id}

Let us now if it helps.
Veronika IvhedVeronika Ivhed
Thanks for your reply. I changed to: 
window.top.location.replace("{!URLFOR($Action.Opportunity.New, null, [saveURL='/apex/RedirectToCompetitorAgreement',retURL='%2F+{!opportunity.id}',nooverride=1,save=1], true)}");
But still the record type selection page is shown twice. 
Suma GangaSuma Ganga
Hi Veronika,

For record type selection in page, you have to check your profile, default record type.

u have to select only one record type as default for the profile. then it will redirect to your corresponding  pagelayout based on your page layout assignment for the record type.


-- Suma.
 
Suma GangaSuma Ganga
Veronika,
 this is for ur ref.

User-added image


--  Suma .
Veronika IvhedVeronika Ivhed
Hi Suma,
Having one default record type will not solve my issue since I want the users to be able to select from two different record types. 
/Veronika
Raghu PedabbaRaghu Pedabba
Hi Veronika,

I am having same issue , how did you solve your problem?

Thanks,
Raghu