Iam working on LWC component.
On NEW button click LWC component opened.
Enter data on fields and click on 'Create Account' button, it should redirect/navigate user to 'listing/record' page.
OR click on cancel button it should redirect user to 'listing/record' page.
right now when click on 'Create Account' button, data added successfully with no redirection/navigation to listing page.
Cancel button only resting the fields.
Thanks in Advance.
Best Answer
NavigationMixin controls navigation to Salesforce pages or the creation of URLs to those pages. You can go to edit, view, etc. Here is the documentation: https://developer.salesforce.com/docs/component-library/bundle/lightning-navigation/documentation.
Here is the js class, notice the info in "header", it is really important:
Finally, I would suggest you set up LWC Recipes, if you haven't already... many of the basic things you will want to do are built out. This will save you hours and hours of time: https://github.com/trailheadapps/lwc-recipes
Good luck!