Quantcast
Channel: Active questions tagged fields - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 63

How to get field label from metadata in LWC (lightning web component)

$
0
0

I want to get a field label from metadata. In this usage, it isn't part of data. I just want the label for elsewhere on the page. Getting it from metadata instead of hardcoding it will aid in translatibility.

In Apex, I would code --

SObjectType.MyObject__c.fields.MyField__c.getLabel()

In VisualForce, I'd code --

{!$ObjectType.MyObject__c.Fields.MyField__c.Label}

I'm preferring whatever is analogous to the VisualForce solution as I really don't want to have to go to the Apex controller just to get labels.

I found this thread from four years ago which uses the UI api, I suppose that may be one way but I'm wondering if it's improved since then and there is a more efficient way.

Get Object Label from API Name in LWC using wire


Viewing all articles
Browse latest Browse all 63

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>