2

Passing complex structured data type from Lightning to Apex Controller causes Internal Error with Gack Id 263119078

Internal Error with Gack Id 263119078

    var action = component.get( "c.saveModel" );
    action.setParam( "model", component.get("v.model") );
    action.setCallback(this, function(response) {});
5

I didn't even open a Salesforce ticket for this one, just observed that to avoid this Salesforce internal platform bug I can pass my model as JSON string

    var action = component.get( "c.saveModel" );
    action.setParam( "jsonModel", JSON.stringify( component.get("v.model") ) );
    action.setCallback(this, function(response) {});

and to change my Apex Controller from

 public static Model saveModel( Model m ) {
     // perform some action with m
     return m;
 }

to

 public static Model saveModel( String jsonModel ) {
     Model m = (Model) JSON.deserialize( jsonModel, Model.class );
     // perform some action with m
     return m;
 }
  • Should your param jsonPM be jsonModel or does the name not matter? I had the same issue with a wrapper class. – Phil Hawthorn Jan 9 '17 at 20:09
  • Good point, Phil. When I was trying to generalize my code, I replaced my custom parameter only in one place, but I should have replace it in both places, I will update my answer – Patlatus Jan 11 '17 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.