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
Adrian van Wyk 8Adrian van Wyk 8 

Trying to open new Salesforce console tab from a lightning component

Hi,

I have a lighting component with a few buttons on it that I have added to my users home page in the lightning app builder.

These buttons need to launch various flows in new primary tabs in their Salesforce Console. I am aware that one can use a visual force page and use the intergrations toolkit. However the problem is that VF is rendered in an iFrame on the console home page which doesn't allow the JS to interact with the parent window. So when I attempt to execute the sforce.console.openPrimaryTab() function it doesn't do anything.

Is there a way to launch the VF page in a new tab using a lighting component button. I have tried force.navigateToURL but that just opens it in the home tab which I don't want.

Below is my code which is yeilding no result
 
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
    <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="x-ua-compatible" content="ie=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <apex:slds />
            <script src="/support/console/40.0/integration.js" type="text/javascript"></script>
        	<script>
            	function openTab()
            	{
                	sforce.console.openPrimaryTab(undefinded, '/flow/' + flow, true, 'New Bike');
            	}
        </script>
        </head>
    </html>
    <body>
        
        <div class="slds-scope">
            <div class="slds-border--bottom slds-m-bottom--medium">
                <h1 class="slds-page-header__title slds-m-right--small slds-align-middle slds-truncate" title="Flow Launcher">
                    Flow Launcher
                </h1>
            </div>
            <div class="slds-m-top--medium">
                <button class="slds-button slds-button--brand" onclick="openTab()">Link 1</button>
                <button class="slds-button slds-button--brand">Link 2</button>
                <button class="slds-button slds-button--brand">Link 3</button>
            </div>
        </div>

    </body>
</apex:page>

Any help would be great thanks.
Marc D BehrMarc D Behr
Hi Adrian,

I have a similar situation, I have a page that I want to have open a new tab when using the new Service Console and it appears that it is unable to properly detect that you are using Lightning and do the right thing. Looking around a bit, I found this - https://developer.salesforce.com/docs/atlas.en-us.208.0.api_console.meta/api_console/sforce_api_console_methods_lightning.htm which indicates that the features that we need are currently in Pilot, so you need to be among the 'select few' to be able to even test the functionality. :-(

Marc