1

The lightning/uiObjectInfoApi module includes wire adapters to get object metadata and picklist values.

getObjectInfo -> Can we fetch only metadata of particular field instead of whole object metadata ?

Something like below:

import SingleField from '@salesforce/schema/Opportunity.anyfield';

@wire(getObjectInfo, { objectApiName: SingleField })

We have a adapter to fetch a particular field value like below :

@wire(getRecord, { recordId: '$recordId', fields: [Anyfield] }) oppty; get Anyfield() { return getFieldValue(this.oppty.data, Anyfield); }

In the same format I'm looking to fetch only one particular filed label in lwc, In case someone have solution please let me know.(Like getFieldInfo)

Thanks in advance.

Note: Please note without using LDS.

1 Answer 1

3

There's no API to get the describe for a single field, so there's also no LWC wire method you can use.

4
  • Thank you @sfdxfox :) , just for confirmation is it a okay to load a entire object just to fetch 1 field label name ? or just put it in a custom label and show in html?
    – vkm
    Commented Jun 10, 2020 at 20:31
  • @vkm Yes, it's fine. Note that the system caches these describe calls, so they're not terribly inefficient overall.
    – sfdcfox
    Commented Jun 10, 2020 at 22:01
  • @sfdxfox Thank you, I'm now fetching it from schema itself. There is no significant impacts on load performance, as you said it caches and subsequent transactions are fast compared to on initial one.
    – vkm
    Commented Jun 10, 2020 at 22:50
  • I have posted a Idea here in case please let me know your thought -> success.salesforce.com/ideaView?id=0873A0000003grnQAA having a adapter like getFieldInfo would be very helpful when we have a huge page containing many objects ref.
    – vkm
    Commented Jun 10, 2020 at 23:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .