function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sowmya YakkalaSowmya Yakkala 

How to insert Record in Location Object in Salesforce Lightning Component

When i going to create a Record in Location (Standard Object) iam not getting values from Component to Js (Controller).Can any one plz Suggest me.

<aura:attribute name="newLocation"  type="Location" default="{'sobjectType': 'Location'}"/> 
<lightning:input label="Location Name" required="true" value="{!v.newLocation.Name}"/>
                                            <lightning:select label="Location Type" value="{!v.newLocation.LocationType}">
                                                <option value="">--None--</option>
                                                <aura:iteration items="{!v.locationTypeValues}" var="item">
                                                   <option value="{!item}" selected="selected">{!item}</option>                   
                                            <lightning:input label="Street Name" value="{!v.newLocation.Street_Name__c}"/>
                                            <lightning:input label="City" value="{!v.newLocation.City__c}"/>
                                            <lightning:input label="State"  value="{!v.newLocation.State__c}"/>
                                            <lightning:input label="Zip"   value="{!v.newLocation.Zip__c}"/>
  var newLocation = component.get("v.newLocation");
          var action = component.get("c.createRecord");  
                newLocation : newLocation
                var state = response.getState();
              //  alert('state--'+state);
                if(state === "SUCCESS"){                     
                    var recId = response.getReturnValue();
                    var toastEvent = $A.get("e.force:showToast");
                        "message": "Record created Successfully.",
                         "type": "success"                                                
                } else if(state == "ERROR"){
                    //alert('Error in calling server side action');
                    var toastEvent = $A.get("e.force:showToast");
                        "message": 'Error in calling server side action',
                        "type": "Error"
 Apex Class:
    Public Static void createRecord(List<Schema.Location> newLocation)
        if(newLocation !=null){
            insert newLocation;

Avoid Apex and use e.force:createRecord event. For sample code, check