function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SuAkSuAk 

Visualforce page reference - Internal server error has occurred

Hi - I am creating a visualforce page which Opens a new page for AccountLocation. I have given the action atrribute for the page and I get the follwoing error :
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: 1426062076-3576050 (-425442646)

Please find my visualforce page details and controller class details below :
Visualforce :
<apex:page standardController="AccountLocation__c" extensions="AccountLocationEditController" action="{!pageredir}" >
controller :
Public class AccountLocationEditController{
   Public AccountLocation__c AccLoc {get;set;}
    Public string var {get;set;}
    Public AccountLocationEditController(ApexPages.StandardController Controller) {}
   
   public Pagereference pageredir()
    {
        var= ApexPages.currentPage().getParameters().get('Id');
        if(var!=null)
         {
            Pagereference newpage = new Pagereference ('/apex/AccountLocationEdit');
            return newpage;
            }
       else
            {
            Pagereference newpage = new Pagereference('/apex/AccountLocationEdit') ;
            return newpage;
            }
    }


Please help me rectify this error.

Thanks!



 
jigarshahjigarshah
SuAk,

Couple of questions here.
  1. Do you have Lightning Experience enabled for your Salesforce org? If yes, then the url that you are trying to redirect to may not work.
  2. Have you checked the Debug Logs to identify the exact root cause of failure.
  3. Other thing is I see a couple of challeneges with the shared code. Please use the updated code as below. One thing is that <apex:page tag was not closed.
Apex Controller Code
public class AccountLocationEditController{
   
   public AccountLocation__c AccLoc {get;set;}
   
   //Constructor
   public AccountLocationEditController(ApexPages.StandardController stdController) {}
   
   public Pagereference redirect(){
		return new Page.AccountLocationEdit;
   }
}
Visualforce Code
<apex:page standardController="AccountLocation__c" extensions="AccountLocationEditController" action="{!redirect}"/>
Please mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
SuAkSuAk
Hi Shah - I updated the logic of my controller . But now I get a different error :
Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Currency ISO Code: invalid currency code: ". 
Controller :
*************
Public class AccountLocationEditController{
   Public AccountLocation__c AccLoc{get;set;}
   Public AccountLocationEditController(ApexPages.StandardSetController stdController) {
       Id strId= ApexPages.currentPage().getParameters().get('id');
        AccountLocation__c AccLoc = new Apttus_Config2__AccountLocation__c();
         if (strId!=null){
      AccLoc = [SELECT ID,Name,Apttus_Config2__Type__c,CurrencyIsoCode
                  FROM AccountLocation__c
                  WHERE ID =:strId];
       }
   }

Visualforce
******************
<apex:page standardController="Apttus_Config2__AccountLocation__c" extensions="AccountLocationEditController" recordSetVar="AccountLocation__c" >
   
     <script>
      function getlocation()
     {
      location();
      }       
                          
     </script>
   
   
<apex:form id="frm">
    <apex:actionFunction name="location" action="{!location}"  rerender="loc"/>
       
    <apex:pageBlock title="Account Location Edit" mode="edit">
    <apex:pageBlockButtons >
    <apex:commandButton action="{!save}" value="Save" immediate="true"/>
    <apex:commandButton action="{!savenew}" value="Save & New"/>
    <apex:commandButton action="{!Cancel}" value="Cancel"/>
    </apex:pageBlockButtons>
   
    <apex:pageBlockSection id="loc" title="Information" columns="2">
    <apex:inputField value="{!AccLoc.Type__c}" required="true" onblur="this.value" />
    <apex:inputField value="{!AccLoc.AccountId__c}" />
    <apex:inputField value="{!AccLoc.Name}"/>
    <apex:inputField value="{!AccLoc.TaxExempt__c}" />
    <apex:inputField value="{!AccLoc.IsDefault__c}" />
    <apex:inputField value="{!AccLoc.TaxExemptStatus__c}" />
    <apex:inputField value="{!AccLoc.CurrencyIsoCode}" />
    <apex:inputField value="{!AccLoc.CertificateId__c}" />
    </apex:pageBlockSection>
  </apex:pageBlock>
</apex:form>
</apex:page>

Thanks!!
SuAkSuAk
My Debug log
****************

41.0 APEX_CODE,FINE;APEX_PROFILING,FINE;CALLOUT,INFO;DB,NONE;SYSTEM,DEBUG;VALIDATION,NONE;VISUALFORCE,INFO;WAVE,NONE;WORKFLOW,NONE 11:18:03.0 (130815)|USER_INFO|[EXTERNAL]|005210000016ZVf|smeenaks@ansys.com.dev|Eastern Standard Time|GMT-05:00 11:18:03.0 (221460)|EXECUTION_STARTED 11:18:03.0 (233350)|CODE_UNIT_STARTED|[EXTERNAL]|066210000009Hw4|VF: /apex/AccountLocationEdit 11:18:03.0 (60385452)|SYSTEM_MODE_ENTER|true 11:18:03.0 (61312526)|METHOD_ENTRY|[1]|01p21000000GkZj|AccountLocationEditController.AccountLocationEditController() 11:18:03.0 (61354961)|METHOD_EXIT|[1]|AccountLocationEditController 11:18:03.0 (65654450)|SYSTEM_MODE_ENTER|true 11:18:03.75 (75237133)|CUMULATIVE_LIMIT_USAGE 11:18:03.75 (75237133)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 11:18:03.75 (75237133)|TOTAL_EMAIL_RECIPIENTS_QUEUED|0 11:18:03.75 (75237133)|STATIC_VARIABLE_LIST| char[]:DigitTens:0 long:serialVersionUID:0 long:serialVersionUID:0 String:_sfdcAdditionalCodeLocations:0 double:MAX_VALUE:0 Boolean:FALSE:0 long:serialVersionUID:0 double:MIN_VALUE:0 int:SIZE:0 String:_sfdcSuppressedCodeLocations:0 double:NEGATIVE_INFINITY:0 int:MAX_VALUE:0 char[]:digits:0 double:NaN:0 Boolean:TRUE:0 String:__sfdcProperties:0 int:MIN_VALUE:0 char[]:DigitOnes:0 int:BYTES:0 int:MIN_EXPONENT:0 int[]:sizeTable:0 String:_sfdcAdditionalCodeLocations:0 int:MAX_EXPONENT:0 int:SIZE:0 double:POSITIVE_INFINITY:0 double:MIN_NORMAL:0 int:BYTES:0 11:18:03.75 (75237133)|CUMULATIVE_LIMIT_USAGE_END 11:18:03.0 (75525378)|CODE_UNIT_FINISHED|VF: /apex/AccountLocationEdit 11:18:03.0 (76484058)|EXECUTION_FINISHED 11:18:03.78 (78289101)|CUMULATIVE_PROFILING_BEGIN 11:18:03.78 (78289101)|CUMULATIVE_PROFILING|No profiling information for SOQL operations 11:18:03.78 (78289101)|CUMULATIVE_PROFILING|No profiling information for SOSL operations 11:18:03.78 (78289101)|CUMULATIVE_PROFILING|No profiling information for DML operations 11:18:03.78 (78289101)|CUMULATIVE_PROFILING|method invocations| External entry point: public void <init>(ApexPages.StandardSetController): executed 1 time in 2 ms Class.AccountLocationEditController.<init>: line 4, column 1: global public static System.PageReference currentPage(): executed 3 times in 0 ms 11:18:03.78 (78289101)|CUMULATIVE_PROFILING_END