Newer Version Available

This content describes an older version of this product. View Latest

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:
  • {componentType: 'CASE_EXPERT_WIDGET' }
  • {componentType: 'FILES_WIDGET' }
  • {componentType: 'HIGHLIGHTS_PANEL' }
  • {componentType: 'KNOWLEDGE_ONE'}
  • {componentType: 'MILESTONE_WIDGET' }
  • {componentType: 'TOPICS_WIDGET' }
  • {componentType: 'VISUALFORCE' }
Types that require additional parameters:
  • {componentType: 'CANVAS', canvasAppId: '09Hxx0000000001'}
  • {componentType: 'RELATED_LIST', listName: 'Solution'}
  • {componentType: 'LOOKUP', fieldName: 'Account'}
  • {componentType: 'VISUALFORCE', pageName: 'VF1'}
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/57.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.