
Navigate to Record LWC – Reusable Navigation Component for Flow
Introduction:
In many Salesforce implementations, we build Screen Flows to guide users through business processes. But one common challenge is navigation.
After creating or updating a record inside a Flow, users often need to manually search for that record to continue their work. That adds friction.
To solve this, I built a reusable Navigate to Record Lightning Web Component (LWC) that can be embedded inside a Screen Flow. It allows seamless navigation to any record without leaving the Flow context manually.
This component makes Flow-driven processes smoother and more user-friendly
What Problem Does This Solve?
By default, Flow does not provide a simple out-of-the-box way to navigate users to a specific record dynamically.
Typical scenarios
After creating a record in Flow → redirect to that record
After updating a record → take the user back to its detail page
Use Flow as a guided process → then move the user to the final record.
This LWC bridges that gap.
What This Component Does?
The Navigate to Record LWC:
Accepts a Record Id as input
Uses
NavigationMixinRedirects users to
Record View Page
Record Edit Page (optional if configured)
Can be used directly inside a Screen Flow
How It Works (Concept)
The component:
Accepts
recordIdas a public property.Uses
NavigationMixin.Navigate.Navigates to the standard record page using
standard__recordPageview action
Because it is exposed to Flow, you can pass the record Id from Flow variables directly into the component.
import { LightningElement, api } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class NavigateToRecord extends NavigationMixin(LightningElement) {
@api recordId;
@api actionName = 'view';
connectedCallback() {
if (this.recordId) {
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Record Created. Navigating...',
variant: 'success'})
);
// Navigate immediately
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.recordId,
actionName: this.actionName
}
});
}
}
}Navigates to a specific record in Salesforce.
lightning__FlowScreen
Technical Highlights
Built using Lightning Web Components
Uses lightning/navigation
Exposed via targets for
lightning__FlowScreenFully reusable across objects
No Apex required
Summary
The Navigate to Record LWC is a small but powerful enhancement for Salesforce Flows. It removes friction, improves navigation, and provides a seamless transition from automation to record interaction. If you are building Flow-driven solutions, this is a lightweight component worth adding to your toolkit.
Comments (0)
Leave a Reply