Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

focusSidebarComponent()

Focuses the browser on a sidebar component. Use this method to focus on a component with the tab or accordion sidebar style.

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/68.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.