function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ranjith DevRanjith Dev 

Perform a single server call in lightning Application instead of multiple calls

Hi,
Perform a single server call in lightning Application instead of multiple calls. in my application i have written the lightning components to print the fieldsets data. must avoid the server calls for every lightning component in lightning application and make it one server call. How can i achieve this.
Thanks
SwethaSwetha (Salesforce Developers) 
HI Ranjith,
You can try to make calls in the init method as explained in https://stackoverflow.com/questions/57126292/perform-a-single-server-call-in-lightning-instead-of-multiple-calls
Define a custom Apex class in your controller that encapsulates all of the information you wish to source in a single call from your init event:

public class InitializationWrapper {
    @AuraEnabled 
    public List<String> myStringList {get; set;}
    @AuraEnabled 
    public Decimal myDecimal {get; set;}
    @AuraEnabled 
    public String myString {get; set;}
}
Then, return an instance of this wrapper class from your server-side Apex call to your init handler. You only need to make a single round-trip.
Related: https://salesforce.stackexchange.com/questions/140554/call-multiple-helper-methods-as-order-in-lightning-controller/140559

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you