In this example we use the lighting record-edit-form to add the standard lookup component to a Lightning Web Component (LWC).
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.
Credits:
The code below has been adapted from the cookbook recipe http://developer.force.com/cookbook/recipe/automated-unit-test-execution. Re-posting this since the link appears to be broken.
STEP 1:
STEP 2:
Create the apex classes below.
STEP 3:
Schedule the apex class 'AutomatedTestJobQueuer'. This will run the apex tests.
STEP 4:
Schedule the apex class 'AutomatedTestingJob'. This will send the email. Make sure you have enough gap between these two jobs to allow all tests to run. Sample here is one hour, you might want to increase this if you have many apex tests.
The code below has been adapted from the cookbook recipe http://developer.force.com/cookbook/recipe/automated-unit-test-execution. Re-posting this since the link appears to be broken.
STEP 1:
- Create an object with API name AutomatedTestingQueue__c
- Create a field on this object of type TEST(40) with API name AsyncId__c
STEP 2:
Create the apex classes below.
- Modify the SOQL query to pick test classes to execute. The query in this sample just picks any class with the name TEST in it.
- Also update your email address to receive the results.
STEP 3:
Schedule the apex class 'AutomatedTestJobQueuer'. This will run the apex tests.
STEP 4:
Schedule the apex class 'AutomatedTestingJob'. This will send the email. Make sure you have enough gap between these two jobs to allow all tests to run. Sample here is one hour, you might want to increase this if you have many apex tests.
batch apex
Execute Batch Apex from lightning component with progress bar to show batch job status
4:18 PM
In this post we will see how to execute a batch apex class and add a lightning component to display the progress of the batch job.
The batch job progress status is retrieved from the object AsyncApexJob.
Let's first create a batch job.
Create an apex controller for the lightning component
Create a lightning component for the progress indicator.
In this article we will look at implementing a simple lightning component that displays a list of contacts in a table. We will add a simple client side search box which searches all columns in the table.
Demo Link: https://forcetree-developer-edition.na147.force.com/s/datatabledemo
Demo Link: https://forcetree-developer-edition.na147.force.com/s/datatabledemo