• Penti
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

A few years ago, weset up a Visualforce page to be loaded into a custom section of our Opportunities. It has been working well since we first set it up. However, Monday morning we noticed that it was now only generating this error instead of displaying the data we expected:

 

Content cannot be displayed: Exception common.page.PageInterruptException

 

We don't know what is causing this error. The developer who created the Visualforce page no longer works for our company and we have no other Salesforce developers on staff. Can someone help us determine what is causing this error and explain what can be done to fix it? The Visualforce page itself is pretty simple; it calls an Apex Class that does all the work.

 

Here is the code for the Visualforce page:

 

<apex:page standardController="Opportunity"
standardStylesheets="false" showHeader="false"
extensions="ConfigReportController"
action="{!init}">

<apex:outputText >No book url specified or url is invalid.</apex:outputText>

</apex:page>

 

 

Here is the code for the "ConfigReportController" Apex class (it is set at version 17 of the Salesforce.com API):

 

public class ConfigReportController
{
    private final Opportunity thisopp;
    public Opportunity curropp{get;set;}
    
    public ConfigReportController(ApexPages.StandardController stdController)
    {
        this.thisopp = (Opportunity) stdController.getRecord();
        this.curropp = getOppById(this.thisopp.Id);
    }
    
    public PageReference init()
    {
        String configReportUrl = this.curropp.NXTbook_URL__c;
        
        if(configReportUrl == null) return null;
        
        configReportUrl = configReportUrl.substring(7, configReportUrl.length());
        
        Integer nxtbookIndex = configReportUrl.IndexOf('/');
        if(nxtbookIndex < 0) return null;
        
        Boolean hasTrailingSlash = configReportUrl.endsWith('/');
        Integer endIndex = configReportUrl.length();
        
        if(hasTrailingSlash) endIndex = configReportUrl.length()-1;
        
        configReportUrl = 'http://something.nxtbook.com/report.php?rootfolder='+configReportUrl.substring(nxtbookIndex, endIndex);
        
        return new PageReference(configReportUrl);
    }
    
    private Opportunity getOppById(Id oppId)
    {
        return [SELECT  curropp.NXTbook_URL__c
                    FROM Opportunity curropp WHERE curropp.Id = : oppId];
    }
    
    static testMethod void createReportTest()
    {   
        Opportunity testOpp = new Opportunity(
                                NXTbook_URL__c='http://www.nxtbook.com/nxtbooks/aaaliving/aaaliving_michigan_200911/',
                                Amount=1,
                                StageName='Stage',
                                CloseDate=Date.today(),
                                Name='Test Opportunity Name');
                                
        Database.SaveResult oppResult = Database.insert(testOpp);
        Id oppId = oppResult.getId();
        
        ApexPages.StandardController stdController = new ApexPages.StandardController(testOpp);
        ConfigReportController testController = new ConfigReportController(stdController);
        
        Opportunity testOpp2 = testController.getOppById(oppId);
                                
        stdController = new ApexPages.StandardController(testOpp2);
        testController = new ConfigReportController(stdController);
                                
        testController.init();
    }
}

  • June 13, 2012
  • Like
  • 0

A few years ago, weset up a Visualforce page to be loaded into a custom section of our Opportunities. It has been working well since we first set it up. However, Monday morning we noticed that it was now only generating this error instead of displaying the data we expected:

 

Content cannot be displayed: Exception common.page.PageInterruptException

 

We don't know what is causing this error. The developer who created the Visualforce page no longer works for our company and we have no other Salesforce developers on staff. Can someone help us determine what is causing this error and explain what can be done to fix it? The Visualforce page itself is pretty simple; it calls an Apex Class that does all the work.

 

Here is the code for the Visualforce page:

 

<apex:page standardController="Opportunity"
standardStylesheets="false" showHeader="false"
extensions="ConfigReportController"
action="{!init}">

<apex:outputText >No book url specified or url is invalid.</apex:outputText>

</apex:page>

 

 

Here is the code for the "ConfigReportController" Apex class (it is set at version 17 of the Salesforce.com API):

 

public class ConfigReportController
{
    private final Opportunity thisopp;
    public Opportunity curropp{get;set;}
    
    public ConfigReportController(ApexPages.StandardController stdController)
    {
        this.thisopp = (Opportunity) stdController.getRecord();
        this.curropp = getOppById(this.thisopp.Id);
    }
    
    public PageReference init()
    {
        String configReportUrl = this.curropp.NXTbook_URL__c;
        
        if(configReportUrl == null) return null;
        
        configReportUrl = configReportUrl.substring(7, configReportUrl.length());
        
        Integer nxtbookIndex = configReportUrl.IndexOf('/');
        if(nxtbookIndex < 0) return null;
        
        Boolean hasTrailingSlash = configReportUrl.endsWith('/');
        Integer endIndex = configReportUrl.length();
        
        if(hasTrailingSlash) endIndex = configReportUrl.length()-1;
        
        configReportUrl = 'http://something.nxtbook.com/report.php?rootfolder='+configReportUrl.substring(nxtbookIndex, endIndex);
        
        return new PageReference(configReportUrl);
    }
    
    private Opportunity getOppById(Id oppId)
    {
        return [SELECT  curropp.NXTbook_URL__c
                    FROM Opportunity curropp WHERE curropp.Id = : oppId];
    }
    
    static testMethod void createReportTest()
    {   
        Opportunity testOpp = new Opportunity(
                                NXTbook_URL__c='http://www.nxtbook.com/nxtbooks/aaaliving/aaaliving_michigan_200911/',
                                Amount=1,
                                StageName='Stage',
                                CloseDate=Date.today(),
                                Name='Test Opportunity Name');
                                
        Database.SaveResult oppResult = Database.insert(testOpp);
        Id oppId = oppResult.getId();
        
        ApexPages.StandardController stdController = new ApexPages.StandardController(testOpp);
        ConfigReportController testController = new ConfigReportController(stdController);
        
        Opportunity testOpp2 = testController.getOppById(oppId);
                                
        stdController = new ApexPages.StandardController(testOpp2);
        testController = new ConfigReportController(stdController);
                                
        testController.init();
    }
}

  • June 13, 2012
  • Like
  • 0

Hey,

 

I keep getting this exception in the VF iframe whenever I try to redirect anywhere...

Content cannot be displayed: Exception common.page.PageInterruptException

 

The code that generates this is:

public PageReference appInit() {
	if(false) return null; // for now
	PageReference pageRef = Page.Login;
	pageRef.setRedirect(true);
	return pageRef;
}

 

This method is called from here (on the VF page)

<apex:page language="en" StandardController="Account" showHeader="true" standardStylesheets="true" sidebar="false" extensions="StartupExtension,ZoomAccountExtension" action="{!appInit}">

 

Is I return null I stay on the same page and I do not get this exception but if I try to redirect no matter where I get this exception.

 

Any ideas? please help!!

 

 

-Assaf