+ Start a Discussion
Amit Jadhav 13Amit Jadhav 13 

Cannot read property 'apiName' of undefined


Lightning Component
<aura:component controller="membershipOpportunityViewCMP_controller" implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
	
    <aura:attribute name="foundationName" type="Sobject"/>
    <aura:attribute name="fields" type="String[]" default="['Comment__c']" />
    <aura:attribute name="foundationId" type="String"/>
    <aura:handler event="c:foundationName" action="{!c.foundationId}"/>
    
    <lightning:notificationsLibrary aura:id="notifLib" />
	<lightning:card title="{!v.foundationName.Name +' Comment'}">
        <lightning:recordForm recordId="{!v.foundationId}" 
                              objectApiName="Project__c"
                              fields="{!v.fields}"
                              columns="1"
                              mode="view"	
                              onsuccess="{!c.handleSuccess}"
        					  onerror="{!c.handleError}"/>    
    </lightning:card>
</aura:component>
JS Controller
({
    
    handleSuccess: function (cmp, event, helper) {
        cmp.find('notifLib').showToast({
            "title": "Record updated!",
            "message": "The record "+ event.getParam("id") + " has been updated successfully.",
            "variant": "success"
        });
    },

    handleError: function (cmp, event, helper) {
        cmp.find('notifLib').showToast({
            "title": "Something has gone wrong!",
            "message": event.getParam("message"),
            "variant": "error"
        });
    }
)}

Please help me I'm stuck there I'm new in lightning component
 
Naveen KNNaveen KN
when exactly you are getting this error?

--
Naveen K N