In case you are interested in navigating an user to the standard edit form on click of a button (not using quick actions) then we can use NavigationMixin
In a way, this is similar to
e.force:editRecordin Aura
Here is the snippet!
- We are importing
NavigationMixinfromlightning/navigation - We are providing a config object to
this[NavigationMixin.Navigate] - The config object is going to have information about the destination. The key is providing
editfor the keyactionName
import { LightningElement } from "lwc";
import { NavigationMixin } from "lightning/navigation";
export default class ExploreNavigation extends NavigationMixin(
LightningElement
) {
handleNavigate() {
const config = {
type: "standard__recordPage",
attributes: {
recordId: "00QXXXXXXXXXXlEAJ",
objectApiName: "Lead",
actionName: "edit"
}
};
this[NavigationMixin.Navigate](config);
}
}
Using NavigationMixin in LWC to open a record in edit mode
Hope this helps!
Learn it by building it
Every course, every code repository, the discussion group and certificates of completion — one subscription.