Lightning Components & AuraEnabled method parameters: What’s working and what’s not?

Lightning Components & AuraEnabled Method : What’s Working & What’s Not?

Parameters Passing from client-side to server-side is the much needed part for Lightning component development.

Prerequisite to pass a parameter from client side to server side :  

  1. Value of a Lightning component attribute.
  2. Server side auraEnabled Parametrized action.
  3. Client-side Javascript action that call server-side apex action.

To understand the calling of Apex Method from a lightning component client controller, Read this article.

In Salesforce Lightning Framework the same data type for client-side attribute and server side argument does not work correctly.
Below are some data types that does not work correctly in Lightning Framework :

Integer :

If you set a server side Integer argument with a client side Integer attribute it don’t work correctly.

When the above code execute,it execute correctly but if you perform some mathematical operation on this integer variable a server error comes FATAL_ERROR Internal Error.

the reason for the error is that the integer variable has not correctly casted by the framework. You are bound to typecast the integer variable in your apex code. Add the below code in your apex method it will work fine :

sObjects :

Sobjects can correctly pass from server-side to client side but they don’t work correctly if your sobjects has child relationships records, the child relationships won’t be available in the apex method.

Date :

Next, the date data type attribute also not correctly work if passed from client side to server side. After being set from client side the server side date parameter ends up being null.

The best replacement for this is send the date as string and then typecast it into date datatype in apex.

Wrapper class :

Wrapper class type attribute can also be pass from server side to client side. But to pass a wrapper class type from server side to client side first serialize the attribute at client side and the deserialize it at server side.

Set :

You cannot use a set parameter in an AuraEnabled method. Whenever a class with AuraEnabled method that has set as a parameter is saved an error message come :

Parameter type does not support AuraEnabled.



Leave a Reply


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?