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
LIM AI KHOONLIM AI KHOON 

Update record on server lightning component controller

Hi, may I know why this code does not change/update the field object data? By default, the field object (Final_Approved__c) is false. The type is a checkbox. This code is in lightning environment js.
. . . 
. . .  
},
    yesButton : function(component,event,helper){
        var result = 'SELECT Id FROM ProcessInstanceWorkitem WHERE processInstance.TargetObjectId=\''+component.get('v.sObjectInfo.Id')+'\'';
        var approvals = component.get('v.queryResult');
        var newRecords = []; 
        if(approvals != undefined && approvals.length > 0){          						
            var L = new component.get('v.returnShipment'); 	
            L.id ='Return_Shipment__c.Id';  
			L.Final_Approved__c = true; 
			newRecords.push(L);
            component.set("v.returnShipment",newRecords);
			//window.location.reload();
			var approvalID = approvals[0].Id;
			helper.gotoURL(component, '/p/process/ProcessInstanceWorkitemWizardStageManager?id=' + approvals[0].Id, '_self');

        }
    }
This is the code for the component:
<aura:component controller="LCC_App_rej_Return_shipment_cApex" extends="c:LCC_GenericLightningComponent" >
    
    <aura:set attribute="partially" value="false"></aura:set>
	<aura:set attribute="isAdditionalObject" value="false"></aura:set>
    
    <aura:attribute name="queryResult" type="SObject[]" />
    <aura:attribute name="returnShipment" type="Return_Shipment__c" />
    <aura:attribute name="toggleSpinner" type="boolean" default="false"/>    
	
    <aura:handler event="c:LCC_GenericApplicationEvent" action="{!c.apexQuery}"/>
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>

    <div>
        <div class="slds-scrollable slds-p-around_medium slds-text-heading_small" id="modal-content-id-1">
            <br/>
            <p>Please confirm if this is FINAL APPROVAL?</p>
            <br/>
            <br/>
        </div>
        <aura:if isTrue="{!v.toggleSpinner}">
                <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand" variant="brand">
                    <span class="slds-assistive-text">Loading</span>
                    <div class="slds-spinner__dot-a"></div>
                    <div class="slds-spinner__dot-b"></div>                   
                </div>
        </aura:if> 
        
        <footer class="slds-modal__footer">
            <lightning:button class="slds-button_brand" variant="brand" disabled="{! empty(v.queryResult)}" onclick="{!c.yesButton}" label="Yes"/>
            <lightning:button class="slds-button_brand" variant="brand" disabled="{! empty(v.queryResult)}" onclick="{!c.afterQuery}" label="No"/> 
        </footer>
    </div>
    
    
</aura:component>