Posts

How to call an Apex Method in lightning web component

Hello guys, here I want to tell you that how to call an Apex Method  from Lightning Web Components. After wiring up SObjects, now we are looking into Apex backend integrations. It’s important to understand that a lot of things with SObjects can be done using services, so maybe you don’t need that many Apex at all! :) But if you need Apex, it is very easy and flexible to connect. An Apex method result can be a primitive type, a map or list of primitives, an @AuraEnabled Object, an SObject or a list of them. Any Object which is not AuraEnabled is not permitted, so for example Schema.SObjectType won’t work. First you need to import your Apex methods using this idiom in Js.File  And from this point they are available (almost) like JavaScript methods! How cool is that? There are several tactics to call them, and it really depends on your goal. I describe here the 3 most basic ones, and when they are adequate in Lightning Web Component Passing parameters If the Apex
Recent posts