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
Ryan GreeneRyan Greene 

Save attribute to record

I am trying to set a Lightning Component attribute to a record field. The field is "PersonMailingCity" on the Person Account object, and my code I call the attribute "City". I have created an alert in the JS which displays the City properly, but how can I get that to save to the record? I have this as an attribute as it it calling a separate database to return the City value. I can get my other fields to populate into the record however the "City" will not work. Code below:
Cmp:
<aura:attribute name="City" type="String" />

    <force:recordData aura:id="recordHandler"
                      recordId="{!v.acctId}"
                      layoutType="FULL"
                      fields="Id, FirstName, LastName, PersonEmail, PersonMailingCity, etc."              
                      targetFields ="{!v.editAccountFields}"
                      targetError="{!v.editAccountError}"
                      mode="EDIT"
                      />

    <ui:inputText aura:id="city" value="{!v.City}" label="City" updateOn="keyup"/>
    <lightning:button label="Next" onclick="{!c.next}" variant="brand" />

JS Controller:
next : function(component, event, helper) {
        component.set("v.editAccountFields.Id", component.get("v.acctId"));
        component.set("v.editAccountFields.PersonMailingCity",component.get("v.City"));
        alert('City is ' + component.get("v.editAccountFields.PersonMailingCity"));
                var toastEvent = $A.get("e.force:showToast");
                toastEvent.setParams({
                    "title": "",
                    "message": " - Address has been updated - ",
                    "type": "success"
                });
                toastEvent.fire();
	},