You need to sign in to do that
Don't have an account?

Service Cloud - addEventListener for opening/closing a tab
I created a couple of javascript functions for managing the number
of open tabs inside the service cloud console. I am using addEventListener
for the OPEN_TAB and CLOSE_TAB console events to trigger these functions.
I was also assuming clicking the "+" button for explicitly opening a new tab as well
as closing it would also trigger my functions. The function associated with the
OPEN_TAB was NOT triggered, but the function associated with the CLOSE_TAB
DID get triggered. Not sure why.
I am using the integration.js library, version 30. I tried 31, but it wasn't working
for some reason.
Any help would be appreciated. Thanks, Chris
of open tabs inside the service cloud console. I am using addEventListener
for the OPEN_TAB and CLOSE_TAB console events to trigger these functions.
I was also assuming clicking the "+" button for explicitly opening a new tab as well
as closing it would also trigger my functions. The function associated with the
OPEN_TAB was NOT triggered, but the function associated with the CLOSE_TAB
DID get triggered. Not sure why.
I am using the integration.js library, version 30. I tried 31, but it wasn't working
for some reason.
Any help would be appreciated. Thanks, Chris
Can you please post the code so that we can take a look? It should work for both OPEN_TAB and CLOSE_TAB events the same way, unless there is something I am missing here.
Thank you.
Further things that I have noticed:
- Function incrementNoOfTabs() is triggered when opening a new tab as well as clicking on a tab
that had not as of yet received focus. The difference between the 2 is the objectId from the result
object. If opening a brand new tab, the objectId is set to "undefined". Of focusing on a tab, the objectId
is set to spaces.
- I am dealing with only primary tabs at this point. When closing a tab, decrementNoOfTabs() is called
just fine. But the Id in the result object is set as a subtab ID.
IE. scc-st-# as opposed to scc-pt-#
That's why I'm keying off of 'st' instead of 'pt'
Let me know if you need further info
Thanks, Chris
twice. Once containing a primary tab Id ( scc-pt-# ) and once containing a
subtab id ( scc-st-# ). And, as I mentioned earlier, I am only using primary
tabs.
Another question I have ( separate topic ) is is there a way to somehow disable
or hide the "+" button for adding a new tab ?
Thanks for your help.
Chris
You are correct. I think there is some issue with the Standard Events OPEN_TAB & CLOSE_TAB and they seem to be not working as they are supposed to. Since these events are just one release old, I think no one really figured out the issue or opened at ticket. I will see what I can do and in meantime he is summary of what I am noticing.
1. Clicking + is not triggering the OPEN_TAB event.
2. Opening a tab (via any record) is calling the listener's method twice, once for Primary Tab open and once for Sub Tab open.(Detail)
3. Closing the Tab is firing CLOSE_TAB event everytime.
Thank you
Kartik
I mentioned earlier that I couldn't get the version 31 javascript
toolkit library to work. The one using the relative URL /support/console/.....
The third party option:
<script src="https://c.na1.visual.force.com/support/console/31.0/integration.js" type="text/javascript"></script>
was available to use.
It appears clicking '+' is still not triggering the OPEN_TAB event
in version 31. Close tab is getting fired. So appears to still be an
issue in version 31.
Wanted to let you know.
Thanks, Chris
Did you figure it out any solution, im in same boat now. If you found any alterate solution, can you please share?
<apex:page showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="true" applyBodyTag="true" docType="html-5.0">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<title>ChatAlert</title>
<apex:includeScript value="/support/console/40.0/integration.js"/>
<apex:includeScript value="{!URLFOR($Resource.jquery_ui, 'js/jquery-1.6.2.min.js')}" />
</head>
<body>
</body>
<script>
$(document).ready(function(){
/*
sforce.console.addEventListener(
sforce.console.ConsoleEvent.PRESENCE.WORK_ACCEPTED,
function (result) {
console.log('Accepted work item: ', result);
alert(result.workItemId);
});
*/
sforce.console.addEventListener(
sforce.console.ConsoleEvent.CLOSE_TAB ,
function (result) {
console.log('Closed item', result);
});
});
</script>
</html>
</apex:page>
I am new to salesforce and my requirment is to creating listener to create custom keyboard shortcut to Close All Tabs in the service console.
Can any one help me to write listener class ..
Thanks