I have given a command link to the record and when user clicks on the link it should direct the user to the particular record, url should be generated to particular record dynamically and data should be opened in a new tab.
I can achieve this through Command link but cannot open in new tab.
Its working fine with outputlink or <a href> tag of HTML.
as salesfoce instance name get changed as per edition and Sandbox instances.
you can get current server url as,
controller side
public String SerUrl {get;set;}
in constructor,
SerUrl=ApexPages.currentPage().getHeaders().get('Host');
use this SerUrl variable in VF page instead of hardcoded url
Thanks,
Bala
All Answers
by simply specifying target="_blank" in your href tag
also please explain your requirement in more details
Thanks,
Bala
Ahlada!
Use apex:outputlink or <ahref> tag and keep target="_blank"
so you can open the link in new tab.
Thanks for your Reply
I have given a command link to the record and when user clicks on the link it should direct the user to the particular record, url should be generated to particular record dynamically and data should be opened in a new tab.
I can achieve this through Command link but cannot open in new tab.
Its working fine with outputlink or <a href> tag of HTML.
<apex:outputlink value="https://ap1.salesforce.com/{!emp.id}">{!emp.name}</apex:outputlink>
or
<a href=https://ap1.salesforce.com/{!emp.id}" target="_blank">{!emp.name}</a><br/>
I gave directly the particular url id here. It differs from edition to edition.
Kindly suggest me how to overcome this issue.
as salesfoce instance name get changed as per edition and Sandbox instances.
you can get current server url as,
controller side
public String SerUrl {get;set;}
in constructor,
SerUrl=ApexPages.currentPage().getHeaders().get('Host');
use this SerUrl variable in VF page instead of hardcoded url
Thanks,
Bala