Today we are going to learn about how can we override the ‘Edit’ button of order object by Lightning Web component , i.e standard button given for Edit a record in salesforce .
step 1:- create a LWC component for edit a record
editOrderDetails.html
Edit Order Record
editOrderDetails.js
import { LightningElement,api, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import NAME_FIELD from '@salesforce/schema/Order.Name';
import ACCOUNT_FIELD from '@salesforce/schema/Order.AccountId';
import STARTDATE_FIELD from '@salesforce/schema/Order.EffectiveDate';
import STATUS_FIELD from '@salesforce/schema/Order.Status';
export default class EditOrderDetails extends NavigationMixin(LightningElement) {
// objectApiName is "Order" when this component is called
@api objectApiName;
@api recordId;
// Expose field to make it available in the template
fields = [NAME_FIELD, ACCOUNT_FIELD, STARTDATE_FIELD, STATUS_FIELD];
closeModal() {
// Navigation to Order record
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.recordId,
objectApiName: 'Order',
actionName: 'view'
},
});
}
handleSuccess(event){
const evt = new ShowToastEvent({
title: 'Message',
message: 'The order '+this.recordId+' has been updated successfully.',
variant: 'success',
});
this.dispatchEvent(evt);
// Navigation to Order record
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.recordId,
objectApiName: 'Order',
actionName: 'view'
},
});
}
}
editOrderDetails.js-meta.xml
55.0
true
lightning__AppPage
lightning__RecordPage
lightning__HomePage
lightning__Tab
step 2:- Create a Lightning component
Call Lightning web component that created above in this component because in salesforce we can’t override Edit action button with Lightning web component .
While creating lightning component just put “lightning:actionOverride” in implement section it allow us to override edit standard button.
step 4 :- from object manager tab select order object

Click :- Button links & Action .
Click :- On Edit button .

select your lightning component in lightning component section .
Click :- Now click on save button .
Output :
