0

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

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

| improve this answer | |
  • 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 Jun 10 at 20:31
  • @vkm Yes, it's fine. Note that the system caches these describe calls, so they're not terribly inefficient overall. – sfdcfox Jun 10 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 Jun 10 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 Jun 10 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.