function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashok Kumar 567Ashok Kumar 567 

How to call success method in LWC after NavigationMixin.Navigate update successfully ?

AnudeepAnudeep (Salesforce Developers) 
Hi Ashok, 

My investigation is showing that there is no success method after NavigationMixing.Navigate. If this call is successful, the navigation happens to the page that we define, if there is a failure the Navigation simply does not happen. You can, however, add an if and else to it like the example shown below
 
if(listView !== null && typeof listView !=='undefined' && listView){
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Account',
actionName: 'list'
},
state: {
filterName: listView
},
});
}
else{
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Account',
actionName: 'home',
},
});
}

Anudeep