I have created a VF page which display tooltip information and I want to display those tooltip in separate window or separate popup window during record creation. I have referred below link to open VF page from Toast message messageTemplateData link.
https://developer.salesforce.com/docs/component-library/bundle/force:showToast/documentation
Below is the code that I have tried:
showMyToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
mode: 'sticky',
message: 'This is a required message',
messageTemplate: 'Please Check Tooltip{0} First! & {1}',
messageTemplateData: ['Salesforce', {
url: 'https://myorg.salesforce.com/apex/myVFPageName',
label: 'Click here',
}
]
});
toastEvent.fire();
}
Now when I tested above code, it opens the link within same tab, But I want to open this link in other tab or in separate popup window.If Right Click then it opens in other tab but I want it in single click .If I use window.open(link,'_blank') then as soon as Aura component gets launched, it display toast message and at the same time it launches the link in other tab without manually clicking on the link.
showMyToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
mode: 'sticky',
message: 'This is a required message',
messageTemplate: 'Please Check Tooltip{0} First! & {1}',
messageTemplateData: ['Salesforce', {
url: window.open('https://myorg.salesforce.com/apex/myVFPageName/','_blank'),
label: 'Click here',
}
]
});
toastEvent.fire();
}
If I open any general link then its launching in other tab which is as expected but I am not sure why it's opening the same within same tab when launching VF page.
Below is the code which open link in other tab.
showMyToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
mode: 'sticky',
message: 'This is a required message',
messageTemplate: 'Record {0} created! See it {1}!',
messageTemplateData: ['Salesforce', {
url: 'http://www.salesforce.com/',
label: 'Click here',
}
]
});
toastEvent.fire();
}
Can someone please suggest how to open VF page in separate tab or in popup window from Toast Message messageTemplateData link?