I have a app-level custom component module (the ones in the footer) for a service cloud application. I need to open up a Primary Tab in the console from this custom component.
I have the Id of the Account that I want to open the primary tab for but I am running into issues because the component seems to be a child window of the main console. This is giving me the following issues:
sforce.console.openPrimaryTab(accountId, "/ui/support/servicedesk/ServiceDeskPage", true);
The above code doesn't work (nothing happens at all), I think because there is no console in the child window. I need to reach the console window via window.parent
.
window.parent.location.replace('/' + accountId);
This actually works, but it opens the record in the standard sales cloud view rather than in the service cloud.
I have also tried:
window.parent.sforce.console.openPrimaryTab(accountId, "/ui/support/servicedesk/ServiceDeskPage", true);
but I get a Permission denied to access property sforce
error
Is there any way I can open a tab from the component?
Also, I am confused as to the second parameter of the openPrimaryTab method (the url). I am assuming that it requires the url of the console.
Many thanks in advance
Edit
Looking at chrome's console readout, I see that I'm getting the following error:
Unsafe JavaScript attempt to access frame with URL [salesforce console domain] from frame with URL [visualforce domain e.g. https://c.xxx.visual.force.com/etc] Domains, protocols and ports must match.
From the article linked to in @techtrekkers comment:
Visualforce pages don’t have access to the srcUp() method, and hence need the Service Cloud Integration Toolkit methods to open new subtabs/ primary tabs.