You need to sign in to do that
Don't have an account?
Kelly K
sforce.console.getEnclosingPrimaryTabId() returning undefined
I'm having trouble figuring out why the following code is not returning an Id so I can get to the point of refreshing my tab. I'm in debug mode and basically what I'm finding is that sforce.console.getEnclosingPrimaryTabId() is returning null. The event listener is firing correctly, so I know it's not an issue with that.
Does anyone see an obvious error that I don't or know of a bug that could be affecting this? Even if I rip the code straight out of Salesforce's documentation, I found that no results are returned.
Does anyone see an obvious error that I don't or know of a bug that could be affecting this? Even if I rip the code straight out of Salesforce's documentation, I found that no results are returned.
<apex:page standardController="Account" extensions="FC_AccountExtension" title="{!account.Name}"> <apex:detail relatedList="true"/> <apex:includeScript value="/support/console/31.0/integration.js"/> <script type='text/javascript'> //Set the title of the tab of the VF page to match the account sforce.console.setTabTitle('{!account.Name}'); var listener = function (result) { alert('Message received from event: ' + result.message); }; function refreshDetailListener() { console.log('refreshDetailListener fired!'); var enclosingPrimaryTabId = sforce.console.getEnclosingPrimaryTabId(); console.log('enclosingPrimaryTabId: ' + enclosingPrimaryTabId ); var enclosingTabId = sforce.console.getEnclosingTabId(); console.log('enclosingTabId: ' + enclosingTabId); } //Add listeners sforce.console.addEventListener('SampleEvent', listener); sforce.console.addEventListener('refreshDetail', refreshDetailListener); </script> </apex:page>
This is what I'm trying to do - refresh the detail page when a console component calls it. However, the sforce.console.getEnclsoingPrimaryTabId() function (even when using a callback) is not returning an Id.
Am I using it wrong?
sforce.console.getEnclosingPrimaryTabId(function(result) {
console.log('getEnclosingPrimaryTab subfunction opened');
sforce.console.refreshPrimaryTabById(result.Id, true);
});
Hi Chris,
Thank you for your response. One of the devs I was working with ended up logging a case with Salesforce support on this. Essentially, they told him that while this functionality can only be replicated through Javascript and not through apex & visualforce - it is an issue specifically with javascript and not a bug in apex:detail element. They told him not to use javascript to invoke a refresh, though they did say that there is no way to properly do the refresh in the console other than using javascript.
So unfortunately, it seems having an automated detail page refresh on update of a component is not possible at this time.