[SalesForce] Unable to understand salesforce error : An internal server error has occurred

I have a VF Page named Analytics_page2

<apex:page controller="TestAnalytic" action="{!IF(true,'/apex/Analytics_page2?repId=00O28000002Fl37','')}">

<apex:form id="formId">
    <apex:pageMessages />
        <apex:outputPanel styleClass="otPanelClass" > 
                <analytics:reportChart size="small" reportId="{!repId}"  />   
        </apex:outputPanel>       

  </apex:form>       

My controller code –

public class TestAnalytic
{
    public Id repId{get;set;}

    public TestAnalytic()
    { 
        repId = ApexPages.currentPage().getParameters().get('repId');
    }
}

My page compiles well but every time I try to preview I get this message from salesforce in my screen –
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 435282640-13661 (-1373969722)

attached screenshot
enter image description here

Any idea what is wrong in this simple code . Thanks in advance 🙂

Best Answer

What you do with your action doesn't make sense really. Are you just trying to redirect the user to another custom page? You will need to create a method in your controller that return a Pagereference then use it into your apex:page action.

Controller

public Pagereference redirectTo(){
     repId = ApexPages.currentPage().getParameters().get('repId');
     // probably better to not hard code this address
     if (repId == null) return new PageReference('/apex/Analytics_page2?repId=00O28000002Fl37');
     return null;
}

Page

<apex:page controller="TestAnalytic" action="{!redirectTo}">
....
Related Topic