+ Start a Discussion
Patrick Mayer 4Patrick Mayer 4 

Conditional subtab opening not working in embedded VF

This is a function that works in my other vf pages. When I am using it from an embedded vf page however, 
sforce.console.isInConsole() always goes false. Any ideas for a work-around.


function openSubtab(id) {
  // Check if user is in the Console, otherwise open as a regular URL
  if (sforce.console.isInConsole()) {
    sforce.console.getEnclosingPrimaryTabId(function(result) {
        sforce.console.openSubtab(result.id, '/' + id, true, '', null);
  } else {
    window.open('/' + id);