• Bill Gravelle SA
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I've searched hours for a solution or even just someone with the same problem, to no avail. Any help would be greatly appreciated. To illustrate the problem, I've created a very simple test.

In SF Classic, I added a home page component to the home page layout, like so:

User-added image

When I click the "Edit" button, the iframe redirects to a new page (the only difference being a GET parameter I add to the URL called "edit"). You can see the address bar in both screenshots holds the same URL. The page itself does not reload, just the iframe.

User-added image

Now I want this same behavior to happen on Lightning Experience. To start, I add the VF page as a component within the Lightning App Builder, and here's the initial result:

User-added image

After clicking "Edit", the entire page gets redirected (rather than just the iframe), as seen below:

User-added image
I'm brought to a completely new page altogether. How can I prevent this from happening? I want the iframe to reload seamlessly, while remaining on the home page.

VF Page:
<apex:page controller="TestRedirect">
    <apex:pageBlock >       
        <apex:pageBlockButtons location="top">
            <apex:form >          
                <apex:commandButton action="{!test}" value="Edit" />                      
            </apex:form>                            
        </apex:pageBlockButtons>
    </apex:pageBlock>
    <apex:outputPanel rendered="{!editing}">
        Editing
    </apex:outputPanel>   
</apex:page>

Controller:
public class TestRedirect
{
    public Boolean editing {get;set;}
    public TestRedirect()
    {
        editing = ApexPages.currentPage().getParameters().get('edit') == 'true';
    }
    public PageReference test()
    {
        PageReference pageRef = Page.TestRedirect;
        pageRef.getParameters().put('edit', 'true');
        pageRef.setRedirect(true);        
        return pageRef;
    }
}
  • May 18, 2021
  • Like
  • 0

I am seeing different behaviors for my Visualforce page depending on whether the user who runs it has development enabled or not.

 

I have two users that have the same role and profile but one has development mode turned on and the other does not.

 

I have a layout for a custom object that includes a Visualforce page as part of the standard layout.  This Visualforce page has an Action button.  The action button performs some logic and then returns a PageReference of the original page with redirect set to true so that the whole page refreshes.

 

When I click the action button as the user who has development enabled, everything works as I expect it to.  When I click the action button as the user who does not have development enabled, the refreshed page is display in the area that used to occupied by the Visualforce page.  The entire Salesforce page is now displayed inside the original page.

 

Has anyone else seen anything like this?  I have read some posts about the Visualforce page and the main page running in different domains and that makes sense - except in this case, if I have development enabled everything works.

 

I also see this same behavior (Salesforce page displayed within the Salesforce page) if I have an unhandled exception in the controller extension for my Visualforce page.  In this case, it doesn't matter whether I am running as a user with development privileges or not.