I have a custom VF Primary Tab Component (Right Sidebar) in the console. That is on the Account layout, this loads to the right with a load of Opportunity information.
The issue I am having is I want to be able to click on the Opportunity name, when this is done it should open the Opportunity as a subtab of the Account... however this is not working -_-
This is my JS:
<script>
var oppId;
function openPrimaryTab(opp){
oppId = opp;
sforce.console.getPrimaryTabIds(showTabId);
}
var showTabId = function showTabId(result) {
sforce.console.openSubtab(result.ids, '/' + oppId + '?isdtp=vw', false, 'salesforce', openSuccess, 'salesforceTab');
};
var openSuccess = function openSuccess(result) {
if (result.success == true) {
alert('Primary tab successfully opened');
} else {
alert('Primary tab cannot be opened');
}
};
</script>
Link: <a href="#" onclick="openPrimaryTab('{!opp.Id}');return false">
Would anyone have any idea what I am doing wrong? I am stumped :/