This post details a basic example to execute an apex method from your lightning javascript controller.
STEP 1:
Create the Apex class. Note the following pointers.
- The method to be executed from your lightning component has to be annotated with @AuraEnabled.
- The method should be either public or global
STEP 2:
Declare your apex class in your lightning component.
STEP 3:
Call your apex method from your Javascript.
Aura
What is the difference between Lightning Web Components, Aura Components and Lightning Design System.
9:35 PM
A few years ago programming on the Salesforce platform primarily involved two languages, Visualforce and Apex. It is MVC (Model View Controller) based and easier to adapt to and start developing your first apps.
However, with the drastic changes to web development over the past few years the focus has moved towards building fast, scalable client based applications with minimal server calls to make the application easier and fast to use.
This lead to developing on the Salesforce platform using Lightning components. This post tries to simplify without going into details the different terms you come across once you get started with Lightning development.
What are Lightning Components ?
You program and develop small components that interact with each other on the salesforce platform. These components can be developed using two programming models.
Lightning web components (LWC) is a much powerful framework with a lot more capabilities than the Aura framework. LWC is comparable to much popular frameworks including Angular, React etc.
LWC is officially recommended for new development, though Aura and LWC can co-exist and work along.
What is the Lightning Design System ?
The lightningdesignsystem.com is a pure CSS based framework that you could use for developing web pages that look and feel like Salesforce Lightning Experience UI. It has extensive support for grids, layouts, input and output elements that are ready to use.
However, with the drastic changes to web development over the past few years the focus has moved towards building fast, scalable client based applications with minimal server calls to make the application easier and fast to use.
This lead to developing on the Salesforce platform using Lightning components. This post tries to simplify without going into details the different terms you come across once you get started with Lightning development.
What are Lightning Components ?
You program and develop small components that interact with each other on the salesforce platform. These components can be developed using two programming models.
- Aura Components
- Lightning Web Components
Lightning web components (LWC) is a much powerful framework with a lot more capabilities than the Aura framework. LWC is comparable to much popular frameworks including Angular, React etc.
LWC is officially recommended for new development, though Aura and LWC can co-exist and work along.
What is the Lightning Design System ?
The lightningdesignsystem.com is a pure CSS based framework that you could use for developing web pages that look and feel like Salesforce Lightning Experience UI. It has extensive support for grids, layouts, input and output elements that are ready to use.