I'm struggling to get fetch data from my component using Lightning Data Service. My component is linked to a custom action to create a new record for a custom object. Below is the error i get when the page load :
---------------myComponent.cmp-----------------------
<aura:component implements="lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<!--components attributes-->
<aura:attribute name="customObject" type="Object"/>
<aura:attribute name="newCustomObject" type="Object"/>
<aura:attribute name="simpleCustomObject" type="Object"/>
<aura:attribute name="customObjectError" type="String"/>
<force:recordData aura:id="customObjectRecordLoader"
LayoutType="FULL"
fields=""
recordId="{!v.recordId}"
targetRecord="{!v.newCustomObject}"
targetFields="{!v.simpleCustomObject}"
targetError="{!v.customObjectError}"
mode="EDIT"
/>
<aura:if isTrue="{!not(empty(v.newCustomObjectError))}">
<div class="recordError">
<ui:message title="Error" severity="error" closable="true">
{!v.newCustomObjectError}
</ui:message>
</div>
</aura:if>
</aura:component>
-------------------myComponentController.js--------------------------------------
({
doInit: function(component, event, helper) {
component.find("customObjectRecordLoader").getNewRecord(
"Custom_Object__c", // objectApiName
null, // recordTypeId
false, // skip cache?
$A.getCallback(function() {
var rec = component.get("v.newCustomObject");
var error = component.get("v.newCustomObjectError");
if(error || (rec === null)) {
console.log("Error initializing record template: " + error);
}
else {
console.log("Record template initialized: " + rec.sobjectType);
}
})
);
}
})
I really don't understand what's wrong with my code so thank a lot for your help!