Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <apex:column >
  2. <apex:facet name="header">Account Name</apex:facet>
  3. <a href="{!$Site.Prefix}/" id="accID" onclick="openAccPrimaryTab('{!lAAW.accountId}','{!lAAW.accountName}');return false;"><apex:outputText id="rmaName" value="{!lAAW.accountName}"/></a>
  4. </apex:column>
  5.  
  6. var globalAccID = '';
  7. var recName = '';
  8. function openAccPrimaryTab(accId,accName) {
  9. debugger;
  10. globalAccID = accId;
  11. recName = accName;
  12. if (sforce.console.isInConsole()) {
  13. //First find the ID of the primary tab to put the new subtab in
  14. sforce.console.getEnclosingPrimaryTabId(openPrimaryTab);
  15. }
  16. else {
  17. window.open('/'+accId,'_blank');
  18. }
  19. }
  20. var openPrimaryTab = function openPrimaryTab(result) {
  21. //Now that we have the primary tab ID, we can open a new subtab in it
  22. var rmaurl = document.getElementById("accID").href;
  23. rmaurl = rmaurl+globalAccID;
  24. var primaryTabId = result.id;
  25. sforce.console.openPrimaryTab(null, rmaurl, true, recName, openSuccess, recName)
  26.  
  27. };
  28. var openSuccess = function openSuccess(result) {
  29. //Report whether opening the new tab was successful
  30. if (result.success == true) {
  31. console.log('Primary tab successfully opened');
  32. } else {
  33. console.log('Primary tab cannot be opened');
  34. }
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement