+ Start a Discussion
SkadamSkadam 

Invalid parameter for function URLFOR

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>
georggeorg

The expression seems fine, Please override the edit button on opportunity with this vf page and edit any existing opportunity. You will see it's working perfectly fine.

 

Thanks,

George

Visit My Blog here

SkadamSkadam

That did work but the thing that  I want to achieve is when user saves the opportunity he should be redirected to my custom VF page :  oppRedirect.

That the reason I need to override the opp new button.