I have a Visualforce page that gets embedded into the opportunity page layout. Part of the embedded page is a command button with an action defined in the controller to redirect the user to another page.
Snippet from controller method referenced by the command button:
public PageReference editDynamicProperties() {
PageReference editpr = Page.AnotherPage;
Map<string, string> params = editpr.getParameters();
params.put('oppId', opportunityFromController.Id);
// Attempt to remove the &inline query string parameter, but it isn't present yet.
if(params.containsKey('inline')) {
params.remove('inline');
}
editpr.setRedirect(true);
System.debug(LoggingLevel.Info,'editDynamicProperties() redirecting to ' + editpr);
return editpr;
}
When the button is pressed the redirection occurs, but the query string picks up the parameter &inline=1
. As a result the page is rendered without any of the standard Salesforce content, such as the AppBodyHeader or sidebar. Manually removing the &inline=1
produces the desired results.
I tried explicitly removing the inline parameter from the PageReference, but it isn't present at that time. I've also tried explicitly adding &inline=0
, the headers still get removed. It doesn't seem to matter what the value of inline is, only that it is present.
How can I redirect from an embedded Visualforce page to another page without becoming inlined?