setSidebarVisible()

Shows or hides a console sidebar based on tabId and region. This method is available in API version 33.0 or later. This method isn’t supported in Lightning Console.

Syntax 

1sforce.console.setSidebarVisible( visible:Boolean, (optional)tabId:String, (optional)region:String, (optional)callback:Function)

Arguments 

NameTypeDescription
visiblebooleantrue to show the sidebar or false to hide the sidebar.
tabIdstringThe ID of the tab on which to show or hide the sidebar.
regionstringThe region on the console where the sidebar is located, such as left or right, top or bottom. Regions are represented as:
  • sforce.console.Region.LEFT
  • sforce.console.Region.RIGHT
  • sforce.console.Region.TOP
  • sforce.console.Region.BOTTOM
callbackfunctionJavaScript method 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 setSidebarVisible() {
13           sforce.console.setSidebarVisible(true,'scc-st-1',sforce.console.Region.LEFT,callback);
14      }
15
16   </script>
17    <A HREF="#" onClick="setSidebarVisible(); return false">SetSidebarToExpand</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:

NameTypeDescription
successbooleantrue if the method call was successful; false otherwise.