I'm creating custom component for creating account record in lightning. I'm using force:recordData tag and getNewRecord method. Problem is when I call getNewRecord method, callback function is never called back and record is never filled. I've tried to fix this problem but without luck.
Component.cmp
<force:recordData
aura:id="accountRecordCreator"
layoutType="FULL"
mode="EDIT"
targetRecord="{!v.account}"
targetFields="{!v.simpleAccount}"
targetError="{!v.accountError}" />
ComponentController.js
var accountCreator = component.find("accountRecordCreator");
accountCreator.getNewRecord("Account", null, false, $A.getCallback(function() {
component.set("v.isWaiting", false);
}));
Best Answer
getNewRecord will give you the template for creating record. You can verify the record object type in callback function using apiname.
below is the component built for account page to create contact.
component: `
`
Controller: