[SalesForce] Reference Custom Metadata Type from Lightning Component

I added a new custom field to custom metadata object in Salesforce. That field (Icon_URL) is a text value that will be used to point to the location of custom icons. I want to be able to reference that in my Lightning component, so the src value of my image points to the value of the custom field:

<img src="{'Custom_metadata__Icon_URL'}" />

I don't know how to reference the custom field in the custom metadata object from my image. Is this possible?

Best Answer

Custom Settings and Custom Metadata types can't be referenced directly in Lightning Component Markup. You have to use Apex layer for it.

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

I had created an idea for support of custom settings, might worth extending for support of custom metadata types.

Related Topic