I am building a generic LWC component and want to read\use\pass field's Value of the Object on which I placed my LWC control on.

I can get the current record's value using @api recordid but then I have to write wired methods to get other fields information, which I want to avoid

How to get\pass value of other fields to the LWC placed on the object's lightning record page\flexi page.


  1. LWC control has public property where I set some value at design time.
  2. LWC can be placed on (any) Object's Lightning Record Page\Home Page.

1 Answer 1


You're meant to load the record by Id. This provides automatic updates to the component when the Lightning Data Service detects changes. You can use the same generic code to load any type of record as follows:

@wire(getRecord, { recordId: '$recordId', layoutTypes: 'Full' }) record;

This will work for any object supported by getRecord.

  • Yes this is one option, but I was looking for something else. In this approach even if I just want to work with very fields then all it fetches all records. Is there an option similar to Visualforce Page ? where we can write example Account.customFIeld name it will pass that value to the @api decorated property in the LWC . Oct 22, 2022 at 17:06
  • @IHaveAQuestion you can do that if you want. A reactive field can reference an API field: @api field name; @wire(getRecord, { recordId: '$recordId', fields: '$fieldName' }) record .. but you're still going to just get record
    – sfdcfox
    Oct 22, 2022 at 17:38
  • Thank you for suggestion and answer :) Oct 22, 2022 at 17:44

You must log in to answer this question.

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