+ Start a Discussion
Dave BerenatoDave Berenato 

Use Formula Field Hyperlink to open in New Window

I'm running into an issue where I have too many buttons on the Lead page and they display in a drop-down list in Lightning. I want to use a Formula Field to open a Visualforce page, so I have this display on the top of the Lightning Lead view.

This is the button:
/apex/Application?leadid={!Lead.Id}&accid={! Lead.AccountId__c}

And the field would be:
HYPERLINK("/apex/Application?leadid="& Id & "accid=" & Account__r.Id , "Application")
I've seen people use "_target" but this forces a new tab in Google Chrome. Can I force a new Window, as well as set the height and width, all from a formula field?
 
Frank Gatlin 9Frank Gatlin 9

To open a new window in a specific size, you would need Javascript or another scripting language.

 

window.open(yoururl, "Popup", "location,status,scrollbars,resizable,width=800, height=800");

Dave BerenatoDave Berenato
Salesforce isn't recognizing the Javascript in the Formula Field.

Should I put this in the code of the Visualforce page? How can I write this so that the URL opens in a new window of a specific size.
Raj VakatiRaj Vakati
Try this 
 
HYPERLINK("/apex/Application?leadid="& Id & "accid=" & Account__r.Id , "Application","_blank")
refer this link 

https://help.salesforce.com/articleView?id=000007600&language=en_US&type=1
Dave BerenatoDave Berenato
Hi Raj. This still opens in a new tab.
Zoe Jong 2Zoe Jong 2
I know this is a bit older, but this may help:
https://help.salesforce.com/articleView?id=tips_for_using_hyperlink_formula_fields.htm&type=5