1// myComponent.js
2import { LightningElement } from "lwc";
3import { NavigationMixin } from "lightning/navigation";
4
5export default class MyComponent extends NavigationMixin(LightningElement) {
6 navigateToRecord(recordId) {
7 this[NavigationMixin.Navigate]({
8 type: "standard__recordPage",
9 attributes: {
10 recordId,
11 actionName: "view",
12 },
13 });
14 }
15
16 handleStatusChange(event) {
17 if (event.detail.status === "FINISHED") {
18 const outputVariables = event.detail.outputVariables;
19 for (let i = 0; i < outputVariables.length; i++) {
20 const outputVar = outputVariables[i];
21 if (outputVar.name === "redirect") {
22 this.navigateToRecord(outputVar.value);
23 }
24 }
25 }
26 }
27}