Print this page

New inline visual force page is not opening in the same window when DEV Mode is ON

Knowledge Article Number 000206137

1. Create a sample VF page(defined below) and extension apex class(defined below) make developer mode ON(Dev mode checkbox is on User record).
2. Add this visual force page to the Account layout.
3. Access the account detail page.
4. Editing an inline record from embedded visual force page in account detail page will open in a new window instead of the same frame.
5. Now uncheck Development mode from user record.
6. Again access the account detail page.
7. Try editing the inline record from embedded visual force page in account detail page, it will open in same frame.

Sample Controller:

public class OpportunitySearchController {

    //added an instance variable for the standard controller
    private ApexPages.StandardController controller {get; set;}
    // the actual account
    private Account a;
    // the results from the search. do not init the results or a blank rows show up initially on page load
    public List<opportunity> searchResults {get;set;}

    public OpportunitySearchController(ApexPages.StandardController controller) {
        this.a = (Account)controller.getRecord();
        //initialize the stanrdard controller
        this.controller = controller;
        //String qry = 'Select Id, Name, StageName, CloseDate, Amount from opportunity Where AccountId =:a.Id';
        //searchResults = Database.query(qry);
        searchResults = [Select Id, Name, StageName, CloseDate, Amount from opportunity Where AccountId =:a.Id];
    //Edit related contract record functionality
    public Pagereference editContr()
        String oppid= ApexPages.currentPage().getParameters().get('oppid'); 
        Opportunity opp = [Select id,Name FROM Opportunity where AccountId];       
        //PageReference neweditcont = new PageReference('/'+oppid+'/e?retURL=/';
        PageReference neweditcont = new PageReference('/'+oppid+'?retURL=/';
        return neweditcont;
Sample Visualforce Page:
<apex:page standardController="Account" extensions="OpportunitySearchController">  
    <style type="text/css">
        body {background: #F3F3EC; padding-top: 15px}
    <apex:form >
        <apex:pageBlock title="Search for Opportunities by Keyword" id="block">
            <apex:pageMessages />
            <apex:pageBlockSection id="resultsBlock" columns="5">
                <apex:pageBlockTable value="{!searchResults}" var="o">
                <apex:column >
                    <apex:commandLink action="{!editContr}" value="Edit">
                       <apex:param name="oppid" value="{!}"/>
                    <apex:column headerValue="Name">
                        <apex:outputLink value="/{!o.Id}">{!o.Name}</apex:outputLink>
                    <apex:column value="{!o.StageName}"/>
                    <apex:column value="{!o.Amount}"/>
                    <apex:column value="{!o.CloseDate}"/>





- This is working as designed.

In dev mode, visualforce page is wrapped in an extra iframe for dev mode feature usually. In this case, to go to other page from visualforce page, it is necessary to replace a parent window itself of the extra iframe.

When using visualforce page for embedding in layout, the visualforce page is wrapped in iframe just like the above. In this case, the above logic has been replacing the parent window of embedded visualforce page.

Workaround: Instead of commandLink use outputlink

i.e. Instead of:
<!-- <apex:commandLink action="{!editContr}" value="Edit">
       <apex:param name="oppid" value="{!}"/>
</apex:commandLink> -->

<apex:outputLink value="/{!o.Id}/e?retURL=/{!Account.Id}">Edit</apex:outputLink>

promote demote