You need to sign in to do that
Don't have an account?

Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}
Hi,
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
helloController.js
harness.app
CreateCandidateRecord.apxc
Thanks in advance
Uttpal
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
<aura:component controller="CreateCandidateRecord"> <aura:attribute name="Tax" type="Taxes__c" default="{'sobjectType': 'Taxes__c', 'Name': '', 'Last_Name__c': '', 'SSN__c': '' }"/> <aura:attribute name="Id" type="String"/> <lightning:input value="{v.Tax.Name}" label="Name" placeholder="Enter name......" /> <lightning:input value="{v.Tax.Last_Name__c}" label="Last Name" placeholder="Enter Last name......" /> <lightning:input value="{v.Tax.SSN__c}" label="SSN No" placeholder="Enter SSN No....." /> <lightning:button variant="brand" label="Save" title="Save" onclick="{!c.doSave}" /> </aura:component>
helloController.js
({ doSave : function(component,event,helper) { var action = component.get("c.createRec"); action.setParams({'contObj':component.get('v.Tax')}); action.setCallback(this,function(data){ componnet.set('v.Id',data.getReturnValue()) }); $A.enqueueAction(action); } })
harness.app
<aura:application extends="force:slds" > <c:hello/> </aura:application>
CreateCandidateRecord.apxc
public class CreateCandidateRecord { @AuraEnabled public static string createRec(Taxes__c contObj){ System.debug('Taxes::' +contObj.Name); insert contObj; return contObj.Id; } }
Thanks in advance
Uttpal
Greetings to you!
You are getting this because of a typo inthe JS controller. You are using componnet.set('v.Id',data.getReturnValue()) instaed of component.set('v.Id', data.getReturnValue());
Semicolon is also missing.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
You are getting this because of a typo inthe JS controller. You are using componnet.set('v.Id',data.getReturnValue()) instaed of component.set('v.Id', data.getReturnValue());
Semicolon is also missing.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thanks it worked my typo error.
Thanks and Regards,
Uttpal Chandra
I want to clear my text fields after inserting the data.Can you help me on this..??
Regards,
Khan Anas
I had also solved it by myself but that has a more line of code.Thanks for this oneliner.
Regards,
Uttpal