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
Dave BerenatoDave Berenato 

Apex: OutputLink to open a new subtab in Lightning Console

I found some code in another post to make a Javascript button open in a new subtab inside the console:
<apex:includeScript value="/soap/ajax/26.0/connection.js"/>
    <apex:includeScript value="/support/console/26.0/integration.js"/>
    <script type="text/javascript">
        window.onload = function(){

        function testOpenSubtab() {
            //First find the ID of the primary tab to put the new subtab in

        var openSubtab = function openSubtab(result){
            var primaryTabId =;
            sforce.console.setTabTitle('Add Rep Note');

I tried it for an apex:outputLink and it didn't work:
<apex:outputLink value="/{! }" target="_blank"  id="theLink"><apex:outputField value="{! record.Name }"/>

The other question (!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=906F0000000BTpTIAW) had code for the Javascript button but I don't know where to put that in the Visualforce Page.

var url = '/apex/Add_Rep_Notes?Id={!Account.Id}&isdtp=vw'; 

if (sforce.console.isInConsole()) { 
} else {,'_blank');
I'm going to need this for several links on the page so I don't know how the "var url" would work.