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
Alex Packard 5Alex Packard 5 

Console API breaks from overridden list page

Create the following visualforce page and name it "TestListPage":
 
<apex:page id="TestListPage" standardController="Lead" recordSetVar="records" >

<apex:includeScript value="/support/console/47.0/integration.js"/>

<script>

function openTab(){
sforce.console.openPrimaryTab(null, '/apex/TestListPage', true, 'PrimaryTab', function(result){
console.log(result);
});
}

</script>

<button onClick="openTab()">New Tab</button>

</apex:page>

Go to Setup -> Object Manager -> Lead -> Buttons Links and Actions and override the List action with the page you just created.

In lightning experience, go to the Sales Console and select Leads in the navigation menu.

Your new page should appear instead of the normal lead list. Click the "New Tab" button on the page.

A new console tab should open with the same page in it. In the javascript console, you'll notice a success message.

In this list on the left, click the "New Tab" button again. This time, the new tab will not open and you will see the following error message: "Error: Invalid request."


It appears to me that the salesforce console api breaks completely in the list side of the page once a console tab loads integration.js


A member of the Salesforce Technical Support team assured me that if I posted this here that Salesforce's Developer Experts would review my post and create a Known Issue.  I look forward to your responses!
Abdul KhatriAbdul Khatri
It works for me. Can you please share the screen shot of the issue you are receiving.
Alex Packard 5Alex Packard 5
1.  This screenshot shows me initially navigating to the leads tab in the sales console.  It displays my page in the list view.
User-added image

2. This screenshot is after I clicked the "New Tab" button on the left.  As you can see, a new tab has been opened with the same page in it.  Also, a success message has been printed to the console
User-added image

3.  This screenshot is after I clicked the "New Tab" button on the left a second time.  You can see the error message printed in the console.
User-added image

Let me know what other questions you have.  I have seen this problem in multiple orgs, so I am certain I can help you reproduce the issue.
Alex Packard 5Alex Packard 5
Abdul, were these screenshots helpful?  Were you able to replicate the issue?  Do you have any other questions?
Alex Packard 5Alex Packard 5
Any updates, Abdul?
Alex Packard 5Alex Packard 5
Once again the Salesforce Developer Forums have proven completely useless.  Thanks for nothing

Salesforce, you are bad at addressing instability in your platform
Danish HodaDanish Hoda
Hi Alex,
I replicated your mentioned steps and have come up to the same issue you are facing.
I tried googling and found out to be the known issue, please refer - https://success.salesforce.com/issues_view?id=a1p3A0000008k7xQAA&title=sforce-console-openprimarytab-api-not-opening-a-tab-in-new-tab-and-throwing-javascript-error.

It says this been resolved in Winter'18 but we both are still getting the same issue.
Alex Packard 5Alex Packard 5
Great, thank you Danish!

Thanks for finding that known issue.  It does seem like it may be the same problem or at least something related.

If you're listening, Salesforce, that known issue needs to be reopened or a new one needs to be created.
Alex Packard 5Alex Packard 5
Update:  I finally annoyed enough people at Salesforce that they looked into the problem with me.  They were unable to reproduce the issue on their machines for some reason.  They even gave me access to one of their orgs and I was able to reproduce it on my machine and they were not.

While I am happy that I finally got them to look into this, it is still very frustrating because I know that this is an issue that I can easily reproduce on everyone's machine in my office!  If anybody finds this please help me out and maybe we can get enough info to figure out why Salesforce isn't seeing the problem.