You need to sign in to do that
Don't have an account?
Ujwala Mane 17
Why parameter from client side to server side passed using JSON format?
Hi i have a doubt,
when we pass parameter from client side to server side, we specify it in JSON format in setParams or when we send list or map it is converted into JSON while sending.. So why it is so??
Similarly when we return parameter from apex to client side response we recived in JSON format.. so why is that??
Please help me to understand this..
when we pass parameter from client side to server side, we specify it in JSON format in setParams or when we send list or map it is converted into JSON while sending.. So why it is so??
Similarly when we return parameter from apex to client side response we recived in JSON format.. so why is that??
Please help me to understand this..
AuraEnabled Annotation in Salesforce
The @AuraEnabled annotation enables client- and server-side access to an Apex controller method. Providing this annotation makes your methods available to your Lightning components (both Lightning web components and Aura components). Only methods with this annotation are exposed.
Passing Data to an Apex Controller
Use action.setParams() in JavaScript to set data to pass to an Apex controller.
The request payload includes the action data serialized into JSON.
Returning Data from an Apex Server-Side Controller
Return results from a server-side controller to a client-side controller using the return statement. Results data must be serializable into JSON format.
When an instance of an Apex class is returned from a server-side action, the instance is serialized to JSON by the framework.
--
Magulan Duraipandian
www.infallibletechie.com