Sunday 1 March 2015

How to open a new record inside a console by visual force page ( VF page ):- isInConsole()



Determines if the page is in the Salesforce consoleThis method is only available in API version 22.0 or later.


Solution :-

Include JS in VF page


<apex:includeScript value="/support/console/26.0/integration.js"/>

Write below Java Script code in VF page


<script>

function openTab(id, name) 
{
 if (sforce.console.isInConsole())
  sforce.console.openPrimaryTab(undefined, '/' + id + '?isdtp=vw', true, name);
 else
  window.top.location.href = '/' + id;
}

</script>


Then use below link to open new record .


<a href="#" onclick="openTab('{!Obj.id}''{!Obj.name}'); return false;">{!Obj.customKey}</a>








No comments:

Post a Comment