You need to sign in to do that
Don't have an account?
AK-2
Redirect user from embedded VF page
I have a VF page that's embedded within the standard opportunity page layout. When user clicks on a commandbutton on the VF page, the user needs to be redirected to a custom page from the opportunity page. I have a commandbutton on the VF page with controller action that has code something like this:
How can I redirect the user to the custom page completely? Please note the command button is on the VF page not on the opportunity page.
Thank you.
Public PageReference OpenCustomPage(){ PageReference pr = new PageReference('apex/MyCustomPage?LongVersion=1&Id='+optty.Id+'&retUrl=/'+optty.Id); pr.setRedirect(true); return pr; }However, when user clicks on the button instead of the entire opportunity page getting replaced, the VF page within the Opportunity page is replaced and the user remains on the opportunity page.
How can I redirect the user to the custom page completely? Please note the command button is on the VF page not on the opportunity page.
Thank you.
Best Answer chosen by AK-2
AK-2
Okay, I was able to solve this by using javascript instead of controller action. I added onclick event handler on the vfpage like this: