• Skadam
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

I have written the following code for VF page and I have overridden opportunity new button with my VF page

 The problem is that when I click new opportunity, I am directed to record type pick list page to select the opportunity record type. When I select the opportunity type and hit continue, I am getting redirected to the same page! After that when I hit continue again, I am getting redirected to the next page correctly.

 

<apex:page standardController="Opportunity">

<script>

window.top.location.replace("{!URLFOR($Action.Opportunity.New, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], true)}");

</script>

</apex:page>

 

I have look into some posts and added parameters, save=1 and nooverride=1 in URLFOR method  shown below.

window.top.location.replace("{!URLFOR($Action.Opportunity.New, null, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id, RecordType='/'+opportunity.RecordTypeId, save=1, nooverride=1], TRUE)}");

 

this did eliminate the repeated twice selection of record type but now it just dose is default  selects the first record type even when I select the other record type.

The thing that I want to achieve is redirect user to a custom VF page and he saves the opportunity  I am unable to fix the problem of getting redirected to the same page when I click continue first time though.

  • December 05, 2013
  • Like
  • 0

Hi

 

i am trying to override the new button for Opportunity so when user save the opportunity he is redirected to a custom VF page.

but when i create an new opportunity and select an record type i am getting Error due to URLFOR method, below is code as well as error message.

 

Visualforce Error:


Invalid parameter for function URLFOR

Error is in expression '{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}' in component <apex:page> in page oppurl

 

<apex:page standardController="Opportunity">
<script> 
window.top.location.replace("{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}");
</script>
</apex:page>
  • December 05, 2013
  • Like
  • 0

Hi

 

i am trying to override the new button for Opportunity so when user save the opportunity he is redirected to a custom VF page.

but when i create an new opportunity and select an record type i am getting Error due to URLFOR method, below is code as well as error message.

 

Visualforce Error:


Invalid parameter for function URLFOR

Error is in expression '{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}' in component <apex:page> in page oppurl

 

<apex:page standardController="Opportunity">
<script> 
window.top.location.replace("{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}");
</script>
</apex:page>
  • December 05, 2013
  • Like
  • 0

I have written the following code for VF page and I have overrided opportunity new button with this page:

 

<apex:page standardController="Opportunity"> <script> window.top.location.replace("{!URLFOR($Action.Opportunity.New, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], true)}"); </script> </apex:page>

 

The problem is that when I click new opportunity, I am directed to another page that has a pick list to select tha opportunity type. When I selct the opportunity type and hit continue, I am getting redirected to the same page! But when I hit continue again, I am getting redirected to the next page correctly..I am unable to fix the problem of getting redirected to the same page when I click continue first time though..any help is appreciated!