You need to sign in to do that
Don't have an account?
Aratz Guerra
Uncaught Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
Hi, this is my Lightning component code:
But when I select a Date, the following error appears:
Uncaught Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
throws at https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:31064:9. Caused by: Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22401:12
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
PropertyReferenceValue.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:15155:41
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22402:17
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
Object.onNodeValueChange()@https://hum.lightning.force.com/components/lightning/input.js:319:27
Object.eval [as input]()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:218:33
runSyntheticEvent()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:128:27
HTMLInputElement.eventListener()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:131:24
Can anyone tell me how to solve it please?
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global"> <!-- Define Attribute--> <aura:attribute name="newQuote" type="Object"/> <aura:attribute name="simpleNewQuote" type="Object" default="{'sobjectType':'SBQQ__Quote__c', 'SBQQ__EndDate__c':2018-01-01}"/> <aura:attribute name="newQuoteError" type="String"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <force:recordData aura:id="QuoteRecordCreator" layoutType="FULL" targetRecord="{!v.newQuote}" targetFields="{!v.simpleNewQuote}" targetError="{!v.newQuoteError}" /> <div class="slds-modal__header"> <h2 class="slds-text-heading--medium">New Quote</h2> </div> <!-- Display the new quote form --> <div class="slds-form_stacked"> <lightning:input aura:id="QuoteField" type="date" name="Notes" label="Offer end date" value="{!v.simpleNewQuote.SBQQ__EndDate__c}"/> <lightning:textarea aura:id="QuoteField" name="Notes" label="Additional notes" value="{!v.simpleNewQuote.SBQQ__Notes__c}"/> <lightning:button label="Create Quote" onclick="{!c.handleSaveQuote}" variant="brand" class="slds-m-top_medium"/> </div> </aura:component>
But when I select a Date, the following error appears:
Uncaught Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
throws at https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:31064:9. Caused by: Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22401:12
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
PropertyReferenceValue.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:15155:41
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22402:17
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
Object.onNodeValueChange()@https://hum.lightning.force.com/components/lightning/input.js:319:27
Object.eval [as input]()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:218:33
runSyntheticEvent()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:128:27
HTMLInputElement.eventListener()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:131:24
Can anyone tell me how to solve it please?
Try this code in your JS controller:
Let me know if it helps.
Thanks!
All Answers
Can you please share the JS controller code as well?
Try this code in your JS controller:
Let me know if it helps.
Thanks!
Also in your component, change line 5 i.e: <aura:attribute name="simpleNewQuote" type="Object" default="{'sobjectType':'SBQQ__Quote__c', 'SBQQ__EndDate__c':2018-01-01}"/>
with
<aura:attribute name="simpleNewQuote" type="Object" default="{'sobjectType':'SBQQ_Quote__c', 'SBQQ_EndDate__c':2018-01-01}"/>