I'm trying to pass a two dimensional array from my lightning controller to apex controller but inner array is coming back as null.

Js controller:

updateIds = [noContactIdLead, noContactIdContact];
var action = component.get('c.updateRecords');

    action.setParams({updateMap: updateIds });

    action.setCallback(this, function(response){


Apex Controller:

 public Static Void updateRecords(List<List<String>> updateMap){

I'm getting Status: An Apex exception was thrown.

The debug of updateMap is showing ([00Qm0000008xbPGPSD, 00Qm0000008xhEvCVR], []) which shows the Ids have been passed, but when I try and access the inner list with updateMap[0] I get System.UnexpectedException: null. How can I access the inner array?

1 Answer 1


The inner array is clearly not "null." You're just getting an exception that you shouldn't be getting. Since this is an UnexpectedException, it's something wrong with the run time (an "Internal Server Error", if you will). Two common workarounds for this would be either (a) serialize the data and parse in Apex, or (b) try splitting the parameters such that you have two single-dimension parameters.

As for the former, this should work:

action.setParams({jsonString: JSON.stringify(updateIds) });


public Static Void updateRecords(String jsonString){
  List<List<String>> updateMap = (List<List<String>>)JSON.deserialize(jsonString, List<List<String>>.class);

For the second:

action.setParams({ contactIds: noContactIdContact, leadIds: noContactIdLead });


public Static Void updateRecords(String[] contactIds, String[] leadIds) {

As a side note, if you're getting an error like this, you really should be creating a case with Support. They can log a bug with R&D to get this fixed in a future release.

You must log in to answer this question.

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