I followed the example provided on this link.
I am trying to open a knowledge article on a new sub-tab in the Service Console, the sub-tab does open but it does not display any content. It keeps 'processing' but nothing appears.
I also tried to replace the article's link to the one generated by the service console but I got the same results.
<apex:page standardController="Case">
<A HREF="https://cs80.salesforce.com/articles/en_US/Procedure/No-Icon/p" onClick="testOpenSubtab();return false">
Click here to open a new subtab</A>
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
function testOpenSubtab() {
//First find the ID of the primary tab to put the new subtab in
sforce.console.getEnclosingPrimaryTabId(openSubtab);
}
var openSubtab = function openSubtab(result) {
//Now that we have the primary tab ID, we can open a new subtab in it
var primaryTabId = result.id;
sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false,
'salesforce', null, openSuccess, 'salesforceSubtab');
};
var openSuccess = function openSuccess(result) {
//Report whether we succeeded in opening the subtab
if (result.success == true) {
alert('subtab successfully opened');
} else {
alert('subtab cannot be opened');
}
};
</script>
Best Answer
You're misunderstanding the basic HTML and JavaScript behind this.
This is not meant to OPEN whatever link you have in the
href
. This is just a link that trips the functiontestOpenSubtab()
then returnsfalse
, which means it is performing the onClick then not navigating to thehref
location, so it doesn't matter what is in that attribute.The link it is actually opening is the second argument of
openSubtab()
, which in the example is "http://www.salesforce.com".So this would work for your example: