How to retrieve custom metadata records based on recordId without Apex SOQL uses of ‘uiRecordApi’ library in Lightning Web Components — LWC | How to get custom metadata record based on recordId without apex Using “lightning/uiRecordApi” library in LWC (Lightning Web Component) Salesforce

Vijayk
3 min readApr 28, 2022

Hey guys, today in this post we are going to learn about How to retrieve custom metadata records based on recordId without Apex SOQL uses of ‘uiRecordApi’ library in Lightning Web Components — LWC Salesforce.

Custom Metadata is the information that describes the configuration of each customer’s organization. You can create your own declarative developer frameworks for internal teams, partners, and customers. Rather than building apps from data, you can build apps that are defined and driven by their own types of metadata.

When you create a custom metadata type, you can reference its values in an advanced formula field. If a field value changes, you can update it in the custom metadata type instead of changing multiple, hard-coded formulas. If you use packaging, define the logic you want and allow your subscribers to customize the details.

Use SOQL to access your custom metadata types and to retrieve the API names of the records of those types. To know more details about Custom Metadata Types, Click Here →

Files we used to get Custom Metadata in LWC without apex →

lwcGetCustomMetaData.html

LWC HTML File

Template HTML file to get the record of Custom Metadata bases on record Id in LWC

lwcGetCustomMetaData.js

LWC JavaScript File

In the javascript file we import the lightning/uiRecordApi library in Salesforce LWC

lwcGetCustomMetaData.css

Style CSS

It is used to fixed the alignment of the data table as padding and border in lwc component.

lwcGetCustomMetaData.js-meta.xml

XML Meta File

It is used to where this lightning web component file you want to display as lightning__AppPage, lightning__RecordPage, lightning__HomePage.

lwcGetCustomMetaDataApp.app

XML Meta File

It is used to call the component to preview on browser.

Final Output → To get source code live demo..

Other related post that would you like to learn in LWC

Create Lightning Web Component HTML →

Step 1:- Create Lightning Web Component : lwcGetCustomMetaData.html

SFDX:Lightning Web Component >> New >> lwcGetCustomMetaData.html

lwcGetCustomMetaData.html [Lightning Web Component HTML]

Create Lightning Web Component JavaScript →

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

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

lwcGetCustomMetaData.js [LWC JavaScript File]

Create LWC Style CSS →

Step 3:- Create Style CSS : lwcGetCustomMetaData.css

SFDX:Lightning Web Component >> New >> lwcGetCustomMetaData.css

lwcGetCustomMetaData.css [Style CSS]

Create Lightning Web Component Meta XML →

Step 4:- Create Lightning Web Component : lwcGetCustomMetaData.js-meta.xml

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

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

Lightning Web Component Meta XML

Create Lightning Application →

Step 5:- Create Lightning Application : lwcGetCustomMetaDataApp.app

From Developer Console >> File >> New >> Lightning Application

lwcGetCustomMetaDataApp.app [Component Application File]

Further post that would you like to learn in LWC

Final Output → To get source code live demo..

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Originally published at https://www.w3web.net on April 28, 2022.

--

--