Include JS in VF page
Write below Java Script code in VF page
Then use below link to open new record .
<apex:includeScript value="/support/console/26.0/integration.js"/>
Write below Java Script code in VF page
<script>var preRecordId; function testOpenSubtab(id, name) { preRecordId= id; //First find the ID of the primary tab to put the new subtab in alert('URL----->'+'{!$CurrentPage.URL}'); if (sforce.console.isInConsole()) sforce.console.getEnclosingPrimaryTabId(openSubtab); else window.top.location.href = '/' + id; } 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 , '/'+preRecordId , true, preRecordId , 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>
Then use below link to open new record .
<a href="#" onclick="testOpenSubtab('{!Obj.id}', '{!Obj.id}');return false">{!Obj.customKey}</a>
No comments:
Post a Comment