function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC12SFDC12 

edit lwc

Hi every one,how to edit and existing record in lwc i used record edit form but it creates a new record but i need to edit the existing record please help.


Thanks in Advance.
AnkaiahAnkaiah (Salesforce Developers) 
Hi,

Refer the below link will help you to proceed further.
https://www.sfdcpoint.com/salesforce/lightning-record-edit-form-lwc/

Thanks!!
CharuDuttCharuDutt
Hii SFDC
Try Below Code
<lightning-record-edit-form record-id={recordId} object-api-name="Contact"
            onsuccess={handleSuccess} onsubmit ={handleSubmit}>
        <lightning-messages>
        </lightning-messages>
        <lightning-output-field field-name="AccountId">
        </lightning-output-field>
        <lightning-input-field field-name="FirstName">
        </lightning-input-field>
        <lightning-input-field field-name="LastName">
        </lightning-input-field>
        <lightning-input-field field-name="Email">
        </lightning-input-field>
        <lightning-button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update">
        </lightning-button>
    </lightning-record-edit-form>


######################################################################

@api recordId;
    handleSubmit(event) {
        console.log('onsubmit event recordEditForm'+ event.detail.fields);
    }
    handleSuccess(event) {
        console.log('onsuccess event recordEditForm', event.detail.id);
    }
Please Mark It As Best Asnwer If It Helps
Thank You!