Print this page

Service Console: openPrimaryTab() does not work with Nested iFrames

Knowledge Article Number 000199127
Scenario: While using a PHP page as the Login page of CTI. 
In PHP page a VF Page has been Embedded using IFrame.  In VF page If we try to open a Primary Tab in console, then we get the error as :- Cannot read property 'registerFunction' of undefined 
Here is the code which is used to open a primary tab on VF page :-
var navigateTo = function(urlString,target,label) { 
	console.log('Is In Console...' + sforce.console.isInConsole()); 
	// Check for service cloud console 
	try { 
		sforce.console.openPrimaryTab(null, urlString, true, label, function(response) { 
			if (!response.success) { 
				//failed to open the SCC tab, show an error to the user, 
				//there must be a tab with the same name open already 
				alert('Sorry, it looks like you already have a tab open for this record.'); 
		return false; 
	} catch (err) {console.log(err);}, target); 
The Salesforce Console Integration Toolkit API Library and the Open CTI Library cannot be used in nested iframes but can be used at the top level. 

promote demote