How do Lightning Components interact with Salesforce?

Posted on

Hi All,

Today one of my blog visitor asked me, how do Lightning Components interact with Salesforce? How does Lightning component get data from server? I thought to write an article on this, it might help you also to understand the architecture of Lightning Component Framework.

Below image will help you in understanding this.



  1. Whenever a Lightning Component or an App runs on browser of Mobile device, it first download all component resources(i.e. Styles, Scripts, Markup) on mobile device. They are contained in browser’s memory to support display and processing that is why we call it client-side.
  2. Now if you want to call a apex method from client side, you will fire an event on client side. This event will call a JavaScript method on client-side. This client-side method will make an HTTP requests to Salesforce to call apex method on server-side. Like you do in VisualForce using action function or other JavaScript.
  3. This HTTP request to call apex method will be asynchronous. Asynchronous means you will make the request and forget about it and the controller returns to the client. The processing will be done on server-side.
  4. In the meantime Salesforce processes the logic by executing some apex.
  5. Finally when it is done with processing and gets some resulted data or not, it makes a callback to the browser/client-side. The client response by invoking an associated JavaScript callback function which extract data passed back by apex methods. This data can be assigned to component attributes. Now display will be automatically refreshed.

Hope this will be helpful 🙂

5 thoughts on “How do Lightning Components interact with Salesforce?

    […] Source: How do Lightning Components interact with Salesforce? […]


    Jitendra Zaa said:
    February 10, 2016 at 11:09 pm

    Nice post Balkishan, Can you please share link of whitepaper or documentation as well ?

    Liked by 1 person

      balkishankachawa responded:
      February 11, 2016 at 8:08 am

      Thanks Jitendra Zaa.

      You can find everything in Lightning PDF guide except first point.
      First point I guessed from the features and functionality of Salesforce1 Mobile App.
      Salesforce1 mobile app works on this concept of downloading all the components/application first before running.

      Salesforce1 mobile app is also developed using Lightning Components.

      That’s why I guessed first point on the basis of Salesforce1 Mobile App Functionality.


    […] Source: How do Lightning Components interact with Salesforce? […]


    brahmaji tammana said:
    June 4, 2017 at 3:15 pm

    In short, Salesforce Classic works on MVC architecture where C represents Server Side Controller.
    But in Lightning, It works on MVCC architecture ( in simple terms ) where CC represents 2 controllers – Server side controller and Client Side Controller. Model – View – Controller(Server Side and Client Side).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s