+ Start a Discussion
HoustonAPlusHoustonAPlus 

Page redirection within the page but not redirection entire page

I am trying to extend a standard controller, namely the Opportunity records. I created a VF page that has a custom extension that redirects if a certain condition is not met. I have placed the VF page into the Opportunity page layout and it works..however, it redirects within the field sort of like an iframe. So instead of redirecting the entire window, there is a frame that is showing the targetted page. It works as intended in the sandbox enviornment but oddly the production enviornment does not respond the same way. Is there a step that I am missing or perhaps I miscoded it?

 

VF Page that is inserted into the Opportunity page layout:

 

<apex:page StandardController="Opportunity"  extensions="ExtContactRole" action="{!HasContactRole}" rendered="true">
 

</apex:page>
bob_buzzardbob_buzzard

Unfortunately this is behaving as expected.  The VisualForce page is displayed inside an Iframe on the opportunity view page, so if your page level action redirects, that will simply change the contents of the iframe.   I'm slightly surprised that it works in the sandbox environment, but it may be down to how the pages are served in the sandbox - in production the VF page comes from a different server to the Opportunity view page which may impact how the browser behaves.

 

In order to achieve a redirect of the full page, I suspect that you will need to use javascript to perform the redirect - that will allow you to change the URL of the top level page using window.top.location.href.