1

How to navigate to a standard record page in Communities after a record is created.

Following i tried it's not navigating though.

  this[NavigationMixin.Navigate]({
                type: 'standard__recordPage',
                attributes: {
                    recordId: event.detail.id,
                    objectApiName: 'Case',
                    actionName: 'view'
                },
            });
3
  • There can be three issues: 1) Have you imported and extended "NavigationMixin" module? 2) Do you have access to the Case? 3) Are you getting event.detail.id?
    – Avi Rai
    Commented Jan 31, 2020 at 12:46
  • yes yes yes yes
    – steamyfire
    Commented Jan 31, 2020 at 13:07
  • If you are using a modal for creating a case record then you must write the code for navigating first and then close the modal (or no need to close the modal)
    – Avi Rai
    Commented Jan 31, 2020 at 13:17

2 Answers 2

1

I think you need to use type: 'comm__namedPage' if you're in a community

0
0

Your code will work provided event.detail.id exists and that the component both imports the NavigationMixin and extends NavigationMixin.

import { NavigationMixin } from 'lightning/navigation';

export default class MyComponent extends NavigationMixin(LightningElement) {

    navigate(event) {
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: event.detail.id,
                objectApiName: 'Case',
                actionName: 'view'
            },
        });
    }

}

You must log in to answer this question.

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