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
Srinivas223Srinivas223 

lightning Helper.js passing old values to Apex class instead of edited values

I have a lighning component which displays list of opportunities in the edit mode based on search results of few filters I have on the component. 
On each and every line item i have a Save button to save the reocord and to redirect to the same search results page.
Unfortunately, when i change the values on a opportunity and click Save I can see the opporunity is updating in the debug logs, but, it is getting updated with the old values. it is not considering the values i cahnged.
Here is the code:
Helper
({
	SearchHelper: function(component, event) {
        // show spinner message
         component.find("Id_spinner").set("v.class" , 'slds-show');
        var action = component.get("c.fetchOpportunities");
        action.setParams({
             
            'Owner': component.get("v.Owner"),
            'Stage': component.get("v.Stage"),
            'Division': component.get("v.Division"),
            'Product': component.get("v.ProductName")
        });
        action.setCallback(this, function(response) {
           // hide spinner when response coming from server 
            component.find("Id_spinner").set("v.class" , 'slds-hide');
            var state = response.getState();
            if (state === "SUCCESS") {
                var storeResponse = response.getReturnValue();
                
                // if storeResponse size is 0 ,display no record found message on screen.
                if (storeResponse.length == 0) {
                    component.set("v.Message", true);
                } else {
                    component.set("v.Message", false);
                }
                
                // set numberOfRecord attribute value with length of return value from server
                component.set("v.TotalNumberOfRecord", storeResponse.length);
                
                // set searchResult list with return value from server.
                component.set("v.searchResult", storeResponse); 
                
            }else if (state === "INCOMPLETE") {
                alert('Response is Incompleted');
            }else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        alert("Error message: " + 
                                    errors[0].message);
                    }
                } else {
                    alert("Unknown error");
                }
            }
        });
        $A.enqueueAction(action);
    },
     updateHelper : function(component, event) {
        var opp = event.getSource().get("v.value")
        console.log('oppty-- > ' + JSON.stringify(opp));
        alert(opp.StageName + ' -- ' + opp.CloseDate);
        var action1 = component.get("c.saveOpp");
        action1.setParams({ 'op' : opp ,
                            'Owner': component.get("v.Owner"),
                            'Stage': component.get("v.Stage"),
                            'Division': component.get("v.Division"),
                            'Product': component.get("v.ProductName")});
        action1.setCallback(this, function(response){
            var state = response.getState();
            if(state === "SUCCESS"){
                $A.get('e.force:refreshView').fire();
                console.log('server- > ' + response.getReturnValue());
                alert('Success');
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } 
                else {
                   // console.log(resp.getReturnValue());
                }
            }
        });
        $A.enqueueAction(action1);
    }
})
Controller.Js
({
    doInit : function (component, event, helper) {
         var Owner = component.find('OwnerName');
        var Stage = component.find('searchStage');
        var Division = component.find('searchDivision');
        var Product = component.find('searchProductName');
        var isValueMissing = Owner.get('v.validity').valueMissing;
        // if value is missing show error message and focus on field
        if(isValueMissing) {
            Owner.showHelpMessageIfInvalid();
            Owner.focus();
        }else{
          // else call helper function 
            helper.SearchHelper(component, event);
        }
    
    },  
    Search: function(component, event, helper) {
        var Owner = component.find('OwnerName');
        var Stage = component.find('searchStage');
        var Division = component.find('searchDivision');
        var Product = component.find('searchProductName');
        var isValueMissing = Owner.get('v.validity').valueMissing;
        // if value is missing show error message and focus on field
        if(isValueMissing) {
            Owner.showHelpMessageIfInvalid();
            Owner.focus();
        }else{
          // else call helper function 
            helper.SearchHelper(component, event);
        }
    },
    saveOpportunity : function(component, event, helper) {       
        helper.updateHelper(component, event);
        component.search();

    }
})

I appreciate if someone could help me with this.

Thanks,
Srinivas