You need to sign in to do that
Don't have an account?
How to avoid navigation to newly created record using NavigationMix?
Hi All,
I'm working on a requirement where I want a button that will open a modal to create a new Task record in LWC. For this, I tried using NavigationMixin. But on click of Save in the modal, it redirects to the newly created record page instead of closing the modal. Is there any way to skip the navigation to the newly created record and close the modal only.
Below is the code of NavigationMixin that I'm using:
this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Task', actionName: 'new' } });
Thanks in advance.
#LightningFramework #lightningwebcomponents #LWC #Navigationmixin
I'm working on a requirement where I want a button that will open a modal to create a new Task record in LWC. For this, I tried using NavigationMixin. But on click of Save in the modal, it redirects to the newly created record page instead of closing the modal. Is there any way to skip the navigation to the newly created record and close the modal only.
Below is the code of NavigationMixin that I'm using:
this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Task', actionName: 'new' } });
Thanks in advance.
#LightningFramework #lightningwebcomponents #LWC #Navigationmixin
#LWC
In lightning aura component you have to simply use this code in the handler onclick action method for achieving the scenario :
Hope this helps
Please try this code
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Task',
actionName: 'new'
},
state : {
defaultFieldValues : defaultValue,
navigationLocation: 'RELATED_LIST'
}
})