Salesforce Asked by sfdcnoob on November 23, 2021
I’m using lightning navigation to redirect to a standard record page. However, the redirection takes place in the same tab. Is there a way to open a new tab?
navigateToRecord(event){
var sRecordId = event.target.dataset.id;
if(sRecordId!=='' && sRecordId!==undefined ){
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: sRecordId,
objectApiName: 'My_Object__c',
actionName: 'view'
},
});
}
}
Use NavigationMixin.GenerateUrl
. Then use window.open
to open in a new window.
this[NavigationMixin.GenerateUrl]({
type: "standard__recordPage",
attributes: {
recordId: sRecordId,
objectApiName: 'My_Object__c',
actionName: 'view'
}
}).then(url => {
window.open(url, "_blank");
});
Answered by Rahul Gawale on November 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP