Newer Version Available
focusSidebarComponent()
Focuses the browser on a sidebar component. Use
this method to focus on a component with the tab or accordion sidebar style. For more
information, see “Sidebar Styles for Console Components in Salesforce Classic” in the Salesforce Help. This
method is only available in API version 34.0 or later.
Syntax
1sforce.console.focusSidebarComponent(componentInfo:string (optional)tabId:string, callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| componentInfo | string | The JSON object that represents the component to focus on. This
argument must include one of the following forms: Unambiguous types:
Types that require additional parameters:
|
| tabId | string | The ID of the tab on which to focus the browser. |
| callback | function | JavaScript method that’s called upon completion of the method. |
Sample Code–Visualforce
1<apex:page>
2 <apex:includeScript value="/support/console/50.0/integration.js"/>
3 <script type="text/javascript">
4
5 var callback = function (result) {}
6 if(result.success){
7 alert('Congratulations!');
8 }else{
9 alert('Something is wrong!');
10 }
11 };
12 function focusKnowledgeComponent() {
13 sforce.console.focusSidebarComponent(JSON.stringify({componentType:
14 'KNOWLEDGE_ONE'}),"scc-st-2", callback);
15 }
16 </script>
17 <A HREF="#" onClick="focusSidebarComponent(); return false">Focus Knowledge Component</A>
18</apex:page>Response
This method is asynchronous, so it returns its response in an
object in a callback method. The response object contains the following
field:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if focusing the sidebar component was successful; false otherwise. |