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
Vijaya DVijaya D 

An internal server error has occurred Error ID: 1621501516-145166 (1614096034)

Hi All,

I'm trying to call apex method in lightning aura component. After all successful save I'm getting the error An internal server error has occurred
Error ID: 1621501516-145166 (1614096034) 
 while previewing the application. Can you some help me to sort it out, I'm new to lightning.

 
Best Answer chosen by Vijaya D
Shikhar .Shikhar .
Hi,

Could you pleasedo following things to see what's causing the issue.
1. Remove everything and just try to save the record with the fields (Remove the Education Experience section as well) that you mentioned in your previous comment.
2. If you are able to save the record, try adding the fields one by one so that the error can be traced. 

Regards,
Shikhar

All Answers

SwethaSwetha (Salesforce Developers) 
Hi Vijaya,
Can you share more details on the timestamp along with timezone and the org id so I can check our backend logs to suggest further?

Also, can you share the code snippet I can use to test this behavior in my org

Regards
Swetha Maddali
Salesforce.com Support
Vijaya DVijaya D
Hi Swetha, Please see the requested details below. Time Zone in the Org is : (GMT-08:00) Pacific Standard Time (America/Los_Angeles) Org ID is :00D7F000006OF2N Thanks & Regards, Vijaya K.
SwethaSwetha (Salesforce Developers) 
Can you also include the date of occurrence? 
Vijaya DVijaya D
Hi, I am receiving this error message from Friday (21/Jan/2022 IST).
Vijaya DVijaya D
Hi Swetha, Kindly let me know if any update on this issue?. Regards, Vijaya K.
Shikhar .Shikhar .
Hi,

Can you provide some more details with screenshots of the code that you are using. This might help us resolve the issue.

Regards,
Shikhar
Vijaya DVijaya D
Hi Swetha,

Please see the below code.
 
Welcome_App.app

<aura:application extends="force:slds">
   
    <aura:attribute name="enableRegistrationForm" type="Boolean" default="false"></aura:attribute>
	<aura:attribute name="buttonLabel" type="String" default="Open Registration Form"></aura:attribute>   
    
    <c:Registration_Component/>

</aura:application>
 
Registration_Component.cmp

<aura:component controller="RegistrationFormController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute type="string" name="abc" default="true"/>
    <aura:attribute type="string" name="nameOfStudent" default=""/>
    <aura:attribute type="string" name="parentsName" default=""/>
    <aura:attribute type="string" name="standardOrClass" default=""/>
    <aura:attribute type="string[]" name="numberOfHoursStudy" 
                    default="Less than 1 hour, In between 1 to 4 hours, In between 4 to hours,More than 8 hours"/>
    <aura:attribute type="String" name="userResponse1" default=""/>
    <aura:attribute type="Integer" name="mobileNumber" default=""/>
    <aura:attribute type="Boolean" name="isAvailable" default="false"/>
    <aura:attribute type="Boolean" name="AreYouIntrestedInOnlineCourse" default="false"/>
    <aura:attribute type="Boolean" name="checkBoxValue" default="false"/>
    <aura:attribute type="String" name="PageHeading" default="Registration form for Student"/>
    <aura:attribute type="List" name="addEducationDetailsList" default="[]"/>
    <aura:attribute type="Registration_Form__c" name="RegForm"  default="{'sobjectType':'Registration_Form__c'}"/>
    

    
   <!-- {!v.abc}-->
    <div class="slds-page-header">
    <div class="slds-align_absolute-center">
        <div class="slds-text-heading_large ">
        	{!v.PageHeading}
        </div> 
    </div>
    </div><br/>
    
    <div class="slds-size_1-of-3">
    <lightning:input type="text" name="studentName" label="Enter Your Name" value="{!v.RegForm.Name}"/><br/>
    <lightning:input type="text" name="parentName" label="Enter your Father Name" value="{!v.RegForm.Parent_Name__c}"/><br/>
    <lightning:input type="text" name="currentClass" label="Enter your current Standard" value="{!v.RegForm.Current_Class__c}"/><br/>
    <lightning:select name="NoFStudyHours" label="How many hours you are studing in a day?" value="{!v.RegForm.Study_Hours__c}">
       <!-- <option value="green">1</option>
        <option value="red">2</option>
        <option value="blue">3</option>-->
		<aura:iteration items="{!v.numberOfHoursStudy}" var="hrs">
            <option value="{!hrs}" text="{!hrs}"/>
        </aura:iteration>      
    </lightning:select><br/>
    <lightning:input type="number" name="phoneNumber" label="Enter Your Mobile Number" value="{!v.RegForm.Mobile_Number__c}"/><br/>
    
    <lightning:button variant="brand" label="Add Education Details" onclick="{!c.addEducationDeatils}" iconName="utility:add"/><br/>    
    <aura:iteration items="{!v.addEducationDetailsList}" var="item" indexVar="index">
    	<c:Education_Details addEducationDetailsChild = "{!v.addEducationDetailsList}" indexRef="{!index}"/>      
    </aura:iteration> 
        
    <lightning:input type="checkbox" name="userAvailable" label="Are you available to the class?" value="{!v.isAvailable}"/>	
    <br/>  
    <lightning:input aura:id="checkbox" type="checkbox" name="onlineCourseIntrest" label="Are you intrested in online course?" onchange="{!c.callCheckbox}"/><br/>
        <aura:if isTrue="{!v.checkBoxValue}">
            Happy learning!!:)<br/>
        </aura:if>
        
    <lightning:button label="Submit" class="slds-button slds-button_brand" onclick="{!c.doSubmit}"/>
    </div>
        
</aura:component>

 

Registration_Component.js
doSubmit : function(component, event, helper) {
		/***var intabc = component.get("v.abc");
        if(intabc == "true"){
            alert('Value is True');
        	component.set("v.abc","false");
        }else{
           alert('Value is false');
           component.set("v.abc","true"); 
        }****/
        var regForm = component.get("v.RegForm");
        var action = component.get("c.saveRegistrationFormDetails");
        action.setParams({regForm : regForm});
       
        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("From server: " + response.getReturnValue());

                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });
    	 $A.enqueueAction(action);
	},
Apexclass : RegistrationFormController 

public class RegistrationFormController {

   @AuraEnabled
    public static Id saveRegistrationFormDetails(Registration_form__c regForm){
    
    
        insert regForm;
        
    return regForm.id;
    }
     
}


 
Shikhar .Shikhar .
Hi,

Your code actually seems fine. I tried it with a different SObject called Bear and made it work. 

While declaring the attribute for the sobject, i declared it like this
 
<aura:attribute type="Bear__c" name="RegForm"  default="{'sobjectType':'Bear__c',
                                                            'Age__c':'',
                                                            'Weight__c':'',
                                                            'Sex__c':'Male',
                                                            'Height__c':'',
                                                            'Name':'',
                                                            'Supervisor__c':'0030o00003N1JERAA3'}"/>

Can you please try declaring your sobject like this and see if it works for you as well (Just change the field names and default values)?

Regards,
Shikhar
Vijaya DVijaya D
Hi Shikar,

I tried as per your instruction, but still I'm getting the same error.

Regards,
Vijaya K.
Vijaya DVijaya D
Below is the code snippet which I tried.

<aura:attribute type="Registration_Form__c" name="RegForm"  default="{'sobjectType':'Registration_Form__c','Name':'','Parent_Name__c':'',
                                                                         						'Current_Class__c':'','Study_Hours__c':''}"/>

Regards,
Vijaya K.​​​​​​​
Shikhar .Shikhar .
Hi,

Could you pleasedo following things to see what's causing the issue.
1. Remove everything and just try to save the record with the fields (Remove the Education Experience section as well) that you mentioned in your previous comment.
2. If you are able to save the record, try adding the fields one by one so that the error can be traced. 

Regards,
Shikhar
This was selected as the best answer
Vijaya DVijaya D
Hi Shikhar,

Thank you for your help. Finally was able to find the mistake. 
Here is the mistake in child component (Education details).

Regards,
Vijaya K.