You need to sign in to do that
Don't have an account?
Shefali Vinchurkar2
focusPrimaryTabByName method not working
Hi,
I have made a hyperlink to open a primary tab with the help of javascript (having openPrimaryTab console method)embedded in the hyperlink function of salesforce formula field. The openPrimaryTab consoel method works fine without the focusPrimaryTabByName method, but the focusPrimaryTabByName doesn't work as expected
Below is the code used:
HYPERLINK("javascript:var html_doc = document.getElementsByTagName('head')[0];var js=document.createElement('script');js.setAttribute('type','text/javascript'); var custName ='"& Customer__r.FirstName& ' '&Customer__r.LastName &"';js.setAttribute('src','/support/console/31.0/integration.js');html_doc.appendChild(js);js.onload= function() {sforce.console.focusPrimaryTabByName(custName, focusSuccess); var focusSuccess = function focusSuccess(result){if (result.success == true) {}else{sforce.console.openPrimaryTab(null, '/"& Customer__c &"' , true, '"& Customer__r.Name &"',null,'"& Customer__r.Name &"' );}} ;}; ", Customer__r.FirstName+' '+ Customer__r.LastName ,"_blank")
I have made a hyperlink to open a primary tab with the help of javascript (having openPrimaryTab console method)embedded in the hyperlink function of salesforce formula field. The openPrimaryTab consoel method works fine without the focusPrimaryTabByName method, but the focusPrimaryTabByName doesn't work as expected
Below is the code used:
HYPERLINK("javascript:var html_doc = document.getElementsByTagName('head')[0];var js=document.createElement('script');js.setAttribute('type','text/javascript'); var custName ='"& Customer__r.FirstName& ' '&Customer__r.LastName &"';js.setAttribute('src','/support/console/31.0/integration.js');html_doc.appendChild(js);js.onload= function() {sforce.console.focusPrimaryTabByName(custName, focusSuccess); var focusSuccess = function focusSuccess(result){if (result.success == true) {}else{sforce.console.openPrimaryTab(null, '/"& Customer__c &"' , true, '"& Customer__r.Name &"',null,'"& Customer__r.Name &"' );}} ;}; ", Customer__r.FirstName+' '+ Customer__r.LastName ,"_blank")
1) https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_focusprimarytabbyname.htm
Let us know if this will help you