function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Som_11Som_11 

How to accesses metadata in Aura Component?

Hi all,
When I am hard coding the record type value its working fine. But I am trying like in below picture then its not working.
Like : <aura:attribute name="PriceBookId" type="String" default="$CustomMetadata.Pricebook_Setting__mdt.RetailerPBRT.PBRecordTypeId__c" access="global"/>

How to get the value from metadata over here.User-added image
ShirishaShirisha (Salesforce Developers) 
Hi Somesh,

Greetings!

Custom Settings and Custom Metadata Types can not be referenced directly.So,you need to get this done by using the Apex controller.

Src: https://help.salesforce.com/articleView?id=custommetadatatypes_accessing.htm&type=5

There is an existing Idea created for the same and please go ahead and upvote the same.

https://trailblazer.salesforce.com/ideaView?id=0873A000000E4vkQAC

Also,you can find more details in the below thread:

https://salesforce.stackexchange.com/questions/248557/reference-custom-metadata-type-from-lightning-component

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri