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

HI all i have a dought at lightning component contact creation PFB CODE
<aura:component controller="ContactControllerlightning"> <aura:attribute name="contactObj" type="Contact" default="{'sobjectType':'Contact', 'FirstName':'' , 'LastName':'' , 'phone':''}"/> <aura:attribute name="contactId" type="String"/> <lightning:input value="{!v.contactObj.FirstName}" label="First Name" placeholder="Enter FirstName"/> <lightning:input vlaue="{!v.contactObj.LastName}" label="Last Name" placeholder="Enter LastName"/> <lightning:input value="{!v.contactObj.phone}" label="Phone" placeholder="Enter Phone"/> <lightning:button variant="brand" label="Save" title="Save" onclick="{!c.dosave}"/> </aura:component>
({ dosave : function(component, event, helper) { var action = component.get("c.createContact"); action.setParams({'contObj':component.get('v.contactObj')}); action.setCallback(this,function(data){ component.set('v.contactId',data.getReturnValue()) }); $A.enqueueAction(action); } })
Greetings to you!
Please try the below code to insert contacts using lightning component, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Application:
Component:
Controller:
CSS:
Apex:
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!
Please try the below code to insert contacts using lightning component, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Application:
Component:
Controller:
CSS:
Apex:
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
Follow below steps:
1. Create Apex Class
2. Create Lightning Component.
Please check that you are creating new component from Developer Console -> File -> New -> Lightning Component
3. Create Component's Controller.
Click on Controller from Component Bundle.
4. Create Lightning Application.
Developer Console -> File -> New -> Lightning Application
If the problem still persists, please share screenshots of all the code and the error.
I hope it helps you.
Kindly mark this as solved if the information was helpful. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Instead of value you have typed vlaue.
Also, as lightning is based on aura framework which is a type of JavaScript and JavaScript is case sensitive so lightning is case sensitive. You have phone instead of Phone in a component.
I hope it helps you.
Kindly mark this as solved if the information was helpful. It will help to keep this community clean.
Regards,
Khan Anas
My test class is currently at 66% only, please help.
Thanks,
Ron
Stack Trace: Class.SaveAndNewC.saveDetails: line 6, column 1 Class.SaveAndNewC_Test.test_saveDetails_UseCase1: line 14, column 1