I am trying to edit custom metadata record using lwc. But it is not allowing me to do that. It is showing in read-only format. Here what I have tried,

<lightning-card title="Card Title">
    <lightning-record-edit-form record-id="m050o000000000H" object-api-name="CustomMetadata__mdt">
        <lightning-input-field field-name="Label">
        <lightning-input-field field-name="FirstName">
        <lightning-input-field field-name="LastName">

Here my requirement to edit the custom metadata record and save it to database. But it is not showing in edit format. Can you suggest any idea or approach to accomplish this one.

Thank you.

  • I think you need to use the metadata API to update it from the apex. Jan 29, 2021 at 12:06

1 Answer 1


Custom Metadata records are not data; they are metadata. As such, these are designed to be edited by Admins using the Setup UI and cannot be edited using conventional DML operations.

You can create your own Apex code that uses the Metadata API to support a custom LWC allowing specific changes to certain types of Custom Metadata. You should note, however, that this API is intended for setup purposes rather than frequent data editing, and that changes to custom metadata records have an impact on performance (since caching of the records is naturally disrupted).

You must log in to answer this question.

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