Skip to main content
1 of 4
nicstella
  • 589
  • 1
  • 7
  • 21

Passing Date field from Lightning component to Apex controller shows null

I have a custom salesforce object with a Date field. I am creating a new object of this type in a Lightning component, and trying to push this to the server.

The code calling the server action is this:

var insertAction = cmp.get("c.insertObjects");
insertAction.setParam("objects", objects);      
console.log("entries: " + JSON.stringify(objects));

The log statement there shows a date field

"Day__c":"2016-12-07"

Outputting the passed objects in the controller like this

@AuraEnabled
public static void insertObjects(List<Object__c> objects) {
    System.debug(objects);
}

The debug statement here shows the field as

 Day__c=null

I have tried looking at other answers that were getting errors with Date fields, but can't find any solution or other examples of where the value just gets nulled. How do I fix this?

nicstella
  • 589
  • 1
  • 7
  • 21