I have a custom object Child__c which looks up to Account. I am overriding New button of that Child__c. I am working in Classic and on click of New, I need to show some fields from Account and some fields from Child__c. I am using lightning-record-edit-form for this. Now what I am stuck at is I want to show a field of Child__c (Child_Field__c) as output field and I want to populate it's value from Account field. I already have the Account field value but don't know how I can instantiate Child__c and store the value I have in Child_Field__c and show as output field.

I Googled it and tried couple of links but it is not working.
Fetch Field Label in Lightning Web Components

Can anyone suggest how to do it?

1 Answer 1


You can make use of value attribute of lightning-input-field to prepopulate a field with default value and use disabled attribute to make it read only.

    <lightning-record-edit-form object-api-name="Child__c">
        <lightning-input-field field-name="Account__c"></lightning-input-field>
        <lightning-input-field field-name="Child_Field__c" value={valueFromAccount} disabled></lightning-input-field>
        <lightning-button class="slds-m-top_small" variant="brand"
            type="submit" name="update" label="Update">
  • 1
    Hi Sanket, I appreciate it and tried this, but it is showing grey colored background for disabled text box and I also have a lookup field of account. It shows as grey background and account icon. I can make the change from CSS but while this is a hack, we have a whole team checking for the best practices. So, do you have any other solution to this? Oct 7, 2020 at 8:58
  • And if we try to modify the CSS by adding a .css file, LWC has limitation. Just saw this article. salesforce.stackexchange.com/questions/279878/… Oct 7, 2020 at 9:25
  • accepted the answer as there seem to be no alternate to this at the moment. Thank you for answering and for your blogs as well! Really appreciate it. Oct 7, 2020 at 13:02
  • Thank you @JigarTrivedi Oct 7, 2020 at 14:20

You must log in to answer this question.

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