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
Matthew Ritter 17Matthew Ritter 17 

Opening multiple tabs with one custom link?

I want a custom link to open multiple tabs with one click. Right now we have a bunch of links that open only one tab at a time. Is this possible? I have tried, but cannot figure out the Java Script to make it work.

What we have now:
Custom Link 1 =
window.open("http://www.google.com/search?q={!Lead.Company} {!Lead.City__c} {!Lead.State__c}")

Custom Link 2 = 
window.open("https://foursquare.com/explore?near={!Lead.City__c}%2C%20{!Lead.State__c}&q={!SUBSTITUTE(JSENCODE(Lead.Company),'&','and')}")

Custom Link 3 = etc.

What I want is:
Custom Link =
window.open("https://foursquare.com/explore?near={!Lead.City__c}%2C%20{!Lead.State__c}&q={!SUBSTITUTE(JSENCODE(Lead.Company),'&','and')}") + window.open("http://www.google.com/search?q={!Lead.Company} {!Lead.City__c} {!Lead.State__c}") + etc...
  
SandhyaSandhya (Salesforce Developers) 
Hi Matthew Ritter,

I have not tried it but please refer below links for the similar issue that might help you.

http://stackoverflow.com/questions/8586274/how-to-open-multiple-windows-at-a-same-time-in-salesforce
 
http://stackoverflow.com/questions/7064998/how-to-make-a-link-open-multiple-pages-when-clicked
 
Hope this helps you!

If this helps you please mark it as solved.

Thanks and Regards
Sandhya
Matthew Ritter 17Matthew Ritter 17
Hi Sandhya,

This is helpful, but I still can't get it to work. 

I put copied what you sent me and put it into the custom link editor:
$('a.yourlink').click(function(e) { e.preventDefault(); window.open('http://google.com'); window.open('http://twitter.com'); });

It says "$ is not a function".
FYI, I chose Behavior = Execute JavaScript. 

What do I need to do to make this work? Thanks!