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.