focusSidebarComponent()

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

Syntax

sforce.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

<apex:page>
    <apex:includeScript value="/support/console/64.0/integration.js"/>
    <script type="text/javascript">

        var callback = function (result) {} 
            if(result.success){
            alert('Congratulations!');
        }else{
            alert('Something is wrong!');
        }
    };
        function focusKnowledgeComponent() { 
            sforce.console.focusSidebarComponent(JSON.stringify({componentType:
            'KNOWLEDGE_ONE'}),"scc-st-2", callback);
        }
    </script>
    <A HREF="#" onClick="focusSidebarComponent(); return false">Focus Knowledge Component</A>
</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.