Calling an apex method imperatively and fetching contact record from database without @wire through lightning data-table in LWC

Vijayk
2 min readNov 30, 2020

--

Hey guys, today in this post we are going to learn about How to Call an apex method imperatively and fetching contact record from database without @wire through lightning data-table in LWC.

Files we used in this post example:-

lwcFetchContactRecord.html

Lightning Web Component HTML

Template HTML file for used to write HTML element for user interface.

lwcFetchContactRecord.js

Lightning Web Component JavaScript

It is importing Apex Class, Apex method, Object and fields from “@salesforce/apex/”

lwcFetchContactRecord.js-meta.xml

XML Meta File

It is used for where this lightning web component should be exposed.

lwcAppExampleApex.cls

Apex Controller

It is used for call apex method imperatively in LWC Javascript file.

Live Demo | To know more, use this..

Other related post that would you like to learn in LWC

Step 1:- Create Lightning Web Component : lwcFetchContactRecord

SFDX:Lightning Web Component >> New >> lwcFetchContactRecord

lwcFetchContactRecord [Lightning Web Component HTML]

Step 2:- Create Lightning Web Component : lwcFetchContactRecord.js

SFDX:Lightning Web Component >> New >> lwcFetchContactRecord.js

lwcFetchContactRecord.js [LWC JavaScript File]

Step 3:- Create Lightning Web Component : lwcFetchContactRecord.js-meta.xml

SFDX:Lightning Web Component >> New >> lwcFetchContactRecord.js-meta.xml

lwcFetchContactRecord.js-meta.xml [LWC Meta Data XML]

Lightning Web Component Meta XML

Step 4:- Create Apex Controller : lwcAppExampleApex.cls

SFDX:Create Apex Class >> New >> lwcAppExampleApex.cls

lwcAppExampleApex.cls [Apex Class]

Further post that would you like to learn in LWC

Related Topics | You May Also Like

Categories Tags Salesforce LWC, call an apex method imperatively in lwc, call apex method from lightning component, call apex method imperatively lwc with parameters, call apex method in lwc, call apex method with parameter in lwc, Calling an apex method imperatively and fetching contact record in lwc, Calling an apex method imperatively in lwc, connectedcallback lwc, fetching contact record from database in lwc, lwc pass parameters to apex method, salesforce/apex modules only support default importsTutorial

Originally published at https://www.w3web.net on November 30, 2020.

--

--

Vijayk
Vijayk

Written by Vijayk

Easy to learn step-by-step online tutorial by www.w3web.net

No responses yet