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.
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
| Name | Type | Description |
|---|---|---|
| visible | boolean | true to show the sidebar or false to hide the sidebar. |
| tabId | string | The ID of the tab on which to show or hide the sidebar. |
| region | string | The region on the console where the sidebar is located, such as left or right,
top or bottom. Regions are represented as:
|
| callback | function | JavaScript 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:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if the method call was successful; false otherwise. |