Lightning Web Component How to call Apex Methods in lightning web component: Lightning web component can import methods from apex classes into JavaScript classes using ES6 import. Here is the syntax to import apex classes: you can use default export syntax to import an apex method using @salesforce/apex scoped module into JavaScript controller class. Syntax : import apexMethod from '@salesforce/apex/Namespace.Classname.apexMethod'; ApexMethod : Name of apex method that we are going to use. Namespace : The namespace of the Salesforce organisation. Specifies a namespace unless the organisation uses the default one, in which case don;t specify it. ClassName : Name of the class name. Create Apex Class: In this example , we will be getting account details and will show it on UI using lightning web component. Here is the Apex class. To expose this method in lightning web component, method m...
Posts
Showing posts from 2020