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
akash_dev__cakash_dev__c 

An internal server error has occurred Error ID: 328759786-155666 (-1959361166)

Hi, I am getting the above error when I am executing a lioghtning component.

Below is my code, please help!

Lightning Component :

<aura:component controller="ClaimRequest"    implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" 
                access="global" >
    
    <!-- Include Static Resource-->
    <ltng:require styles = "/resource/SLDS/styles/salesforce-lightning-design-system.min.css"/>
    <!--scripts="/resource/bootstrap/js/jquery.js,/resource/bootstrap/js/bootstrap.min.js"/>-->
    
    <!-- Define Attribue-->
    <aura:attribute name="claimrequest" type="Claim_Request__c" default="{'sobjectType': 'Claim_Request__c',
                                                                         'Claim_Amount__c' : '',
                                                                         'Claim_Date__c' : '' ,
                                                                         'Claim_Month__c' : '',
                                                                         'Claim_Year__c' : '' ',
                                                                         'Claim_Description__c' : '',
                                                                         'Claim__Type__c' : '',
                                                                         'Open_Date__c' : ''
                                                                         }"/>
     <div class="container-fluid">
        <h3>Please Enter The Claim Information</h3>
        <div class="form-group">
            <label>Claim Amount</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Amount__c}"/>
        </div>
        <div class="form-group">
            <label>Claim Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Date__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Month</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Month__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Year</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Year__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Description</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Description__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Type</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Claim_Type__c}"/>
        </div>
         <div class="form-group">
            <label>Claim Open Date</label>
            <ui:inputText class="form-control" value="{!v.claimrequest.Open_Date__c}"/>
        </div>
         
         <div class="col-md-4 text-center">
        <ui:button class="btn btn-default" press="{!c.create}">Create</ui:button>
  </div>
    </div>
</aura:component>

JS controller
({
    create : function(component, event, helper) {
        console.log('Create record');
        
        //getting the claim information
        var claimrequest = component.get("v.claimrequest");
        
        //Validation
        if($A.util.isEmpty(claimrequest.Claim_Amount__c) || $A.util.isUndefined(claimrequest.Claim_Amount__c)){
            alert('Claim Amount is Required');
            return;
        }            
        if($A.util.isEmpty(claimrequest.Claim_Date__c) || $A.util.isUndefined(claimrequest.Claim_Date__c)){
            alert('Claim Date is Rqquired');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Month__c) || $A.util.isUndefined(claimrequest.Claim_Month__c)){
            alert('Claim Month is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Year__c) || $A.util.isUndefined(claimrequest.Claim_Year__c)){
            alert('Claim Year is Required');
            return;
        }
        if($A.util.isEmpty(claimrequest.Claim_Type__c) || $A.util.isUndefined(claimrequest.Claim_Type__c))
        {
            alert('Claim Type is required');
        }
        if($A.util.isEmpty(claimrequest.Open_Date__c) || $A.util.isUndefined(claimrequest.Open_Date__c))
        {
            alert('Claim Open Date is required');
        }
        
        //Calling the Apex Function
        var action = component.get("c.createRecord");
        
        //Setting the Apex Parameter
        action.setParams({
            claimrequest : claimrequest
        });
        
        //Setting the Callback
        action.setCallback(this,function(a){
            //get the response state
            var state = a.getState();
            
            //check if result is successfull
            if(state == "SUCCESS"){
                //Reset Form
                var newClaimRequest = {'sobjectType': 'Claim_Request__c',
                                    'Claim_Amount__c' : '',
                                    'Claim_Date__c' : '' ,
                                    'Claim_Month__c' : '',
                                    'Claim_Year__c' : '',
                                    'Claim_Description__c' : '',
                                    'Claim__Type__c' : '',
                                    'Open_Date__c' : ''                                     
                                   };
                //resetting the Values in the form
                component.set("v.claimrequest",newClaimRequest);
                alert('Record is Created Successfully');
            } else if(state == "ERROR"){
                alert('Error in calling server side action');
            }
        });
        
        //adds the server-side action to the queue        
        $A.enqueueAction(action);

    }
})

Controller Class

public with sharing class ClaimRequest {
    /**
   * Create a new claim request Record
   *
   * @param Claim_Request__c claimrequest  claimrequest record to be inserted
   * 
   */
    @AuraEnabled
    public static void createRecord (Claim_Request__c claimrequest){
        
        try{
            System.debug('ClaimRequest::createRecord::claimrequest'+claimrequest);
            
            if(claimrequest != null){
                insert claimrequest;
            }
            
        } catch (Exception ex){
            
        }
        
    } 

}

Thanks in Advance!
Khan AnasKhan Anas (Salesforce Developers) 
Hi Akash,

I suggest you to clear browser cache and history and then again login to your account. Still, if the problem persists please give a try by attempting the same in a brand new developer org which should probably resolve the issue.

You can refer to the below link with a similar discussion which might help you with the above issue.

https://developer.salesforce.com/forums/?id=9060G000000XiVEQA0

https://salesforce.stackexchange.com/questions/100990/an-internal-server-error-has-occurred-error-id-143631613-25605-15667340

https://ashutoshsfdc.wordpress.com/2017/05/30/internal-server-error-error-id-1433747999-1629-95108586/


Also, please refer to this doc provided by Salesforce to handle errors from an Apex Server-Side Controller:

https://developer.salesforce.com/docs/atlas.en-us.202.0.lightning.meta/lightning/controllers_server_apex_custom_errors.htm


I hope it helps you.

Kindly let me inform if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas
Raj VakatiRaj Vakati
Yor code looks good for me .. Do you have access for the All fields ??

Please go to field level securities and make sure you have VIEW and EDIT access 
akash_dev__cakash_dev__c
Hi Raj V,

I am currently accessing this component as an admin and the issue remains persist. 

I have also a doubt that can it be beacuse some of my fields in the object are picklist and here I have simply used the inputText and yes each user has the permission to view and edit these fields.