You need to sign in to do that
Don't have an account?
Eric Vitucci
From support console open in a new tab.
I have a visual force page in our support console that when yo click on the name of the account it opens the account page. I would like it to open a new tab on the console instead of going to the account and leaving the console. I can't seem to figure out how to do this. Here is my code.
<apex:page showHeader="false" standardStylesheets="false" standardController="Case">
<style>
p.small {
line-height: 0.5;
}
</style>
<p> <font face = "Arial" size = "3"><b><a style="text-decoration:none" href="#" onclick="window.top.location='/{!Case.AccountId}';">{!Case.Account.name}</a></b></font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>Support Level: </b> <apex:outputField value="{!case.Support_Level__c}"/> </font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>Customer Tier: </b> <apex:outputField value="{!case.Customer_Tier__c}"/> </font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>ASA Expiry Date: </b> <apex:outputField value="{!case.ASA_SUB_Next_Renewal_Date__c}"/> </font></p>
</apex:page>
<apex:page showHeader="false" standardStylesheets="false" standardController="Case">
<style>
p.small {
line-height: 0.5;
}
</style>
<p> <font face = "Arial" size = "3"><b><a style="text-decoration:none" href="#" onclick="window.top.location='/{!Case.AccountId}';">{!Case.Account.name}</a></b></font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>Support Level: </b> <apex:outputField value="{!case.Support_Level__c}"/> </font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>Customer Tier: </b> <apex:outputField value="{!case.Customer_Tier__c}"/> </font></p>
<p class="small"> <font face = "Arial" size = "2"> <b>ASA Expiry Date: </b> <apex:outputField value="{!case.ASA_SUB_Next_Renewal_Date__c}"/> </font></p>
</apex:page>
You could leverage the openPrimaryTab() (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_openprimarytab.htm) and openSubTab() (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_opensubtab.htm) methods provided by sforce Javascript library, to open the Account record as a separate Console tab versus a new window.
Using the openPrimaryTab(), your existing code would need the anchor tag to be modified as follows. Please DO NOT forget to mark this thread as SOLVED if this answer helps resolve your issue.
Hello
pass the target attribute set the value that suits you
<a style="text-decoration:none" href="#" onclick="window.top.location='/{!Case.AccountId}';" target="-parent">
When I click on the account name nothing happens, no code error nothing. If I open in a new tab it just show the same tab and doesn't open the account record.