I am passing params from Helper JS to Apex controller. I can see values in Helper Js before passing to Controller.I am getting null values in Apex controller. Here is my code.


<aura:attribute name="recordId" type="Id" />
<aura:attribute name="qli" type="object"/>
<!--<aura:attribute name="AAV" type="object"/> -->
<aura:attribute name="AAV" type="Amore_Asset_Values1__c" default="{ 'sobjectType': 'Amore_Asset_Values1__c',
                'month_00_NRV_Amount': 0.00,
                'month_12_NRV_Amount': 0.00,
                'month_24_NRV_Amount': 0.00,
                'month_36_NRV_Amount': 0.00,
                'month_48_NRV_Amount': 0.00,
                'month_60_NRV_Amount': 0.00}"/>

<aura:attribute name="displayColumns" type="object[]"/>

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <div class="slds">

        <article class="slds-card">
          <div class="slds-card__header slds-grid">
            <header class="slds-media slds-media--center slds-has-flexi-truncate">
              <div class="slds-media__figure">
                <img src="/img/icon/custom51_100/safe32.png"></img>
              <div class="slds-media__body slds-truncate">
                  <a href="javascript:void(0);" class="slds-text-link--reset">
                    <span class="slds-text-heading--small">Eval Planning</span>

            <!-- Save Button -->  
            <div class="slds-no-flex">
              <button class="slds-button slds-button--neutral" onclick="{!c.doUpdate}">Save</button>


Helper JS

doUpdate : function(component, event, helper) {

    var AAV1 = component.get("v.recordId");
    var nrv_month_0 = component.get("v.AAV.month_00_NRV_Amount__c");
    console.log("nrv_month_0 is in doupdate  is  " , nrv_month_0);
    var nrv_month_12 = component.get("v.AAV.month_12_NRV_Amount__c");
    var nrv_month_24 = component.get("v.AAV.month_24_NRV_Amount__c");
    var nrv_month_36 = component.get("v.AAV.month_36_NRV_Amount__c");
    var nrv_month_48 = component.get("v.AAV.month_48_NRV_Amount__c");
    var nrv_month_60 = component.get("v.AAV.month_60_NRV_Amount__c");

    var action = component.get("c.updateAAV");

        "nrv_month_0": nrv_month_0,
        "nrv_month_12": nrv_month_12,
        "nrv_month_24": nrv_month_24,
        "nrv_month_36": nrv_month_36,
        "nrv_month_48": nrv_month_48,
        "nrv_month_60": nrv_month_60,
        "qliId" : AAV1
    action.setCallback(this, function(response) {
         console.log("Response in Update function is " , response.getReturnValue());
         component.set("v.AAV", response.getReturnValue());

Apex Controller

@AuraEnabled  //update method taking arg.s
public static Amore_Asset_Values1__c updateAAV(Decimal nrv_month_0, Decimal                            nrv_month_12
                                     Decimal nrv_month_24,
                                      Decimal nrv_month_36, Decimal nrv_month_48, Decimal nrv_month_60,Id qliId )//Id  qliId

        Amore_Asset_Values1__c AAV1 = [SELECT Id, Quote_Line_Item__c, //LineNumber, ListPrice, Product2Id,Quantity
                                month_00_NRV_Amount__c, month_12_NRV_Amount__c, month_24_NRV_Amount__c,
                                month_36_NRV_Amount__c, month_48_NRV_Amount__c, month_60_NRV_Amount__c FROM Amore_Asset_Values1__c 
                            WHERE Quote_Line_Item__r.id =: qliId];

    system.debug('month 00 value passing from js is ' +nrv_month_0); 
      system.debug('month 12 value passing from js is ' +nrv_month_12); 
    AAV1.month_00_NRV_Amount__c = nrv_month_0;
    AAV1.month_12_NRV_Amount__c = nrv_month_12;
    AAV1.month_24_NRV_Amount__c = nrv_month_24;
    AAV1.month_36_NRV_Amount__c = nrv_month_36;
    AAV1.month_48_NRV_Amount__c = nrv_month_48;
    AAV1.month_60_NRV_Amount__c = nrv_month_60;
    AAV1.Quote_Line_Item__c = qliId ;
     system.debug('AAV1 value in Update function is ' +AAV1);                                     
    //update theQLI;
    //return theQLI;
        update AAV1;
    catch(Exception Ex)
    {system.debug('failed in DML exception');
    system.debug('AAV1 value in Return is ' +AAV1);  
    return AAV1;

I can see values in console log of Helper JS but in Apex debug I am getting null values. Please help.

1 Answer 1


Remove the __c from the component get where you setParams. You did not define them with __c

For example

var nrv_month_12 = component.get("v.AAV.month_12_NRV_Amount")
  • It is interesting.Once I changed the code as suggested it did not show any value in console log for that variable.It did not work.I have changed it back to add __c then it is working fine. I am confused but glad that problem is solved.
    – crmsj
    Mar 2, 2017 at 21:22
  • The Apex serializer for @AuraEnabled methods seems very buggy still. We have experienced the same results you have where it is not working then magically works. As a future workaround if you encounter this again we have switched the method to accept a single String parameter then send the data as a JSON string and deserialize it. While not ideal this approach had always worked.
    – dsharrison
    Mar 2, 2017 at 21:58
  • @crmsj - you need to update your default definition then to be correct - 'month_00_NRV_Amount' need to be 'month_00_NRV_Amount__c'. And I agree the serializer is still buggy...I have a Thread..ahem...rant.. on here about it somewhere
    – Eric
    Mar 2, 2017 at 22:10
  • @D.S and Eric I agree with both of your comments.
    – crmsj
    Mar 3, 2017 at 3:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .