• Randy Ortan
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
I am getting this Error "This page has an error. You might just need to refresh it. Failed to initialize a component [Cannot read properties of undefined (reading 'h')] Failing descriptor: {c:AuraTestApplication}".

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
    <!-- Decalring atttributes -->
    
    <aura:attribute Name = "recordId" type = "string"></aura:attribute>
    
    <aura:attribute Name = "accountRecord" type = "object"></aura:attribute>
    <aura:attribute Name = "accountRecordFields" type = "object"></aura:attribute>
    <aura:attribute Name = "recordLoadError" type = "string"></aura:attribute>
    
    <!-- Handlers -->
    
    <aura:handler name = "{init}" value = "{!this}" action = "{!c.doinit}"></aura:handler>
    
    
    
    <!-- Declaring HTML Markup -->
    
    
    
    <force:recordData aura:id="CreateRecord"                      
                      fields="Name,Description,Phone,Industry,Rating"                        
                      targetRecord="{!v.accountRecord}"
                      targetFields="{!v.accountRecordFields}"
                      targetError="{!v.recordLoadError}"
                      mode="EDIT"
                      />
    
    
    
    <div class="slds-p-around_large">
        
        <lightning:card iconName="standard:account" title="Create Account">
            <div class="slds-p-horizontal--small">
                <lightning:input label="Account Name" value="{!v.accountRecordFields.Name}"/>
                <lightning:input  label="Phone" value="{!v.accountRecordFields.Phone}"/>
                <lightning:input  label="Rating" value="{!v.accountRecordFields.Rating}"/>
                <br/>
                <lightning:button label="Save Contact" variant="brand" onclick="{!c.handleSaveContact}"/>
            </div>
        </lightning:card>
        
    </div>
    
    
</aura:component>



({
    doinit: function(component, event, helper) {
        // Prepare a new record from template
        component.find("CreateRecord").getNewRecord(
            "Account", // sObject type (objectApiName)
            null,      // recordTypeId
            false,     // skip cache?
            $A.getCallback(function() {
                var rec = component.get("v.accountRecord");
                var error = component.get("v.recordLoadError");
                if(error || (rec === null)) {
                    console.log("Error initializing record template: "+error);
                    return;
                }else{
                    console.log("Record template initialized: "+rec);
                }
                
            })
        );
    },
     handleSaveContact: function(component, event, helper) {
        
            component.find("CreateRecord").saveRecord(function(saveResult) {
                if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                    // record is saved successfully
                    var resultsToast = $A.get("e.force:showToast");
                    resultsToast.setParams({
                        "title": "Saved",
                        "message": "The record was saved",
                        "type" : "success"
                        
                    });
                    resultsToast.fire();

                } else if (saveResult.state === "INCOMPLETE") {
                    // handle the incomplete state
                    console.log("User is offline, device doesn't support drafts.");
                } else if (saveResult.state === "ERROR") {
                    // handle the error state
                    console.log('Problem saving contact, error: ' + JSON.stringify(saveResult.error));
                } else {
                    console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
                }
            });
        
    }
})




Can you please help me someone ??
When I am trying to Insert Account records through Lightning Component. I am getting this error"This page has an error. You might just need to refresh it. Error in $A.getCallback() [success is not defined] Callback failed: apex://CreateAccount/ACTION$InsertAcc Failing descriptor: {markup://c:CreateAccountComp}"


This is my Apex class :
User-added image
This is Lightning Component :

User-added image
This is JS :

User-added imageUser-added image

Could you please help help me, Someone ???
I'm working through the Lightning Components.
I am getting this Error "An internal server error has occurred
Error ID: 1774277162-104965 (-1957015340)
",

Could you please help me, Someone???
I am getting this Error "This page has an error. You might just need to refresh it. Failed to initialize a component [Cannot read properties of undefined (reading 'h')] Failing descriptor: {c:AuraTestApplication}".

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
    <!-- Decalring atttributes -->
    
    <aura:attribute Name = "recordId" type = "string"></aura:attribute>
    
    <aura:attribute Name = "accountRecord" type = "object"></aura:attribute>
    <aura:attribute Name = "accountRecordFields" type = "object"></aura:attribute>
    <aura:attribute Name = "recordLoadError" type = "string"></aura:attribute>
    
    <!-- Handlers -->
    
    <aura:handler name = "{init}" value = "{!this}" action = "{!c.doinit}"></aura:handler>
    
    
    
    <!-- Declaring HTML Markup -->
    
    
    
    <force:recordData aura:id="CreateRecord"                      
                      fields="Name,Description,Phone,Industry,Rating"                        
                      targetRecord="{!v.accountRecord}"
                      targetFields="{!v.accountRecordFields}"
                      targetError="{!v.recordLoadError}"
                      mode="EDIT"
                      />
    
    
    
    <div class="slds-p-around_large">
        
        <lightning:card iconName="standard:account" title="Create Account">
            <div class="slds-p-horizontal--small">
                <lightning:input label="Account Name" value="{!v.accountRecordFields.Name}"/>
                <lightning:input  label="Phone" value="{!v.accountRecordFields.Phone}"/>
                <lightning:input  label="Rating" value="{!v.accountRecordFields.Rating}"/>
                <br/>
                <lightning:button label="Save Contact" variant="brand" onclick="{!c.handleSaveContact}"/>
            </div>
        </lightning:card>
        
    </div>
    
    
</aura:component>



({
    doinit: function(component, event, helper) {
        // Prepare a new record from template
        component.find("CreateRecord").getNewRecord(
            "Account", // sObject type (objectApiName)
            null,      // recordTypeId
            false,     // skip cache?
            $A.getCallback(function() {
                var rec = component.get("v.accountRecord");
                var error = component.get("v.recordLoadError");
                if(error || (rec === null)) {
                    console.log("Error initializing record template: "+error);
                    return;
                }else{
                    console.log("Record template initialized: "+rec);
                }
                
            })
        );
    },
     handleSaveContact: function(component, event, helper) {
        
            component.find("CreateRecord").saveRecord(function(saveResult) {
                if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                    // record is saved successfully
                    var resultsToast = $A.get("e.force:showToast");
                    resultsToast.setParams({
                        "title": "Saved",
                        "message": "The record was saved",
                        "type" : "success"
                        
                    });
                    resultsToast.fire();

                } else if (saveResult.state === "INCOMPLETE") {
                    // handle the incomplete state
                    console.log("User is offline, device doesn't support drafts.");
                } else if (saveResult.state === "ERROR") {
                    // handle the error state
                    console.log('Problem saving contact, error: ' + JSON.stringify(saveResult.error));
                } else {
                    console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
                }
            });
        
    }
})




Can you please help me someone ??
When I am trying to Insert Account records through Lightning Component. I am getting this error"This page has an error. You might just need to refresh it. Error in $A.getCallback() [success is not defined] Callback failed: apex://CreateAccount/ACTION$InsertAcc Failing descriptor: {markup://c:CreateAccountComp}"


This is my Apex class :
User-added image
This is Lightning Component :

User-added image
This is JS :

User-added imageUser-added image

Could you please help help me, Someone ???