I am trying to redirect the user in a flow. It works as the following:

Click on URL button -> Redirected to flow -> User fills out LWC embedded in flow -> flow creates record -> Screen flow passes newly created Id back to LWC -> Use NavigationMixin to redirect user

However the user is never redirected. They remain on the 2nd screen. As I understand it you cannot use flow variables in a URL button which is why I am trying to use NavigationMixin.


    navigateToNewOpportunity() {
        console.log('newOppId: ', this.newOppId); //passed from Flow (it is populated)
            type: 'standard__recordPage',
            attributes: {
                recordId: this.newOppId,
                objectApiName: 'Opportunity',
                actionName: 'view'


<?xml version="1.0" encoding="UTF-8"?>
    <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
            <targetConfig targets="lightning__FlowScreen">
                <property name="newOppId" label="New Opportunity Id" type="String" />

2 Answers 2


In your JS: Does your class header look like the one in the following example?

// ... NavigationMixin import ...

// Notice the NavigationMixin(LightningElement)
export default class ExampleLWC extends NavigationMixin(LightningElement){
    //... some code ...
    navigateToNewOpportunity() {
        // your NavigationMixin code here ...

If the class does not extend NavigationMixin, nothing happens when the script runs. The code will deploy without errors but it wont work.

Edit: Also, the component may not work when used from the Flow Debug but may work from wherever the flow is active (App page, Record Page, etc.).


It should work, in dreamhouse we have a flow that does exactly that, please take a look:

  • Could it be something with my XML. I have updated the description
    – some guy
    May 31, 2022 at 14:47
  • Can you copy the full code of your js file?
    – Alba Rivas
    Jun 1, 2022 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .