Newer Version Available

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

describeTabs()

The describeTabs call returns information about the standard and custom apps available to the logged-in user. An app is a group of tabs that works as a unit to provide application functionality. For example, two of the standard Salesforce apps are “Sales” and “Call Center.”

Syntax

1describeTabSetResult []  = connection.describeTabs();

Usage

Use the describeTabs() call to obtain information about the standard and custom apps to which the logged-in user has access. The describeTabs() call returns the minimum required metadata that can be used to render apps in another user interface. Typically this call is used by partner applications to render Salesforce data in another user interface.

In the Salesforce user interface, users have access to standard apps (and may also have access to custom apps) as listed in the Force.com app menu at the top of the page. Selecting an app name in the menu allows the user to switch between the listed apps at any time.

For each app, the call returns the app name, the URL of the logo, whether or not it is the currently selected application for the user, and details about the tabs included in that app.

For each tab, the call returns the tab name, the primary sObject that is displayed on the tab, whether it is a custom tab, and the URL for viewing that tab. Note that the “All Tabs” tab is never included in the list of tabs.

Sample Code—Java

This sample calls describeTabs(), which returns an array of tab set results. Next, for each tab set result, which represents an app, it retrieves some of its properties and gets all the tabs for this app. It writes all retrieved properties to the console.

1swfobject.registerObject("clippy.codeblock-1", "9");public void describeTabsSample() {
2  try {
3    // Describe tabs
4    DescribeTabSetResult[] dtsrs = connection.describeTabs();
5    System.out.println("There are " + dtsrs.length + 
6        " tab sets defined.");
7    
8    // For each tab set describe result, get some properties 
9    for (int i = 0; i < dtsrs.length; i++) {
10      System.out.println("Tab Set " + (i + 1) + ":");
11      DescribeTabSetResult dtsr = dtsrs[i];
12      System.out.println("Label: " + dtsr.getLabel());
13      System.out.println("\tLogo URL: " + dtsr.getLogoUrl());
14      System.out.println("\tTab selected: " + 
15          dtsr.isSelected());
16      
17      // Describe the tabs for the tab set
18      DescribeTab[] tabs = dtsr.getTabs();
19      System.out.println("\tTabs defined: " + tabs.length);
20      
21      // Iterate through the returned tabs
22      for (int j = 0; j < tabs.length; j++) {
23        DescribeTab tab = tabs[j];
24        System.out.println("\tTab " + (j + 1) + ":");
25        System.out.println("\t\tName: " + 
26            tab.getSobjectName());
27        System.out.println("\t\tLabel: " + tab.getLabel());
28        System.out.println("\t\tURL: " + tab.getUrl());
29        DescribeColor[] tabColors = tab.getColors();
30        // Iterate through tab colors as needed
31        DescribeIcon[] tabIcons = tab.getIcons();
32        // Iterate through tab icons as needed
33      }
34    }
35  } catch (ConnectionException ce) {
36    ce.printStackTrace();
37  }
38}

Sample Code—C#

This sample calls describeTabs(), which returns an array of tab set results. Next, for each tab set result, which represents an app, it retrieves some of its properties and gets all the tabs for this app. It writes all retrieved properties to the console.

1swfobject.registerObject("clippy.codeblock-2", "9");public void describeTabsSample() {
2    try {
3      // Describe tabs
4      DescribeTabSetResult[] dtsrs = binding.describeTabs();
5      Console.WriteLine("There are " + dtsrs.Length + 
6          " tab sets defined.");
7          
8      // For each tab set describe result, get some properties 
9      for (int i = 0; i < dtsrs.Length; i++) {
10          Console.WriteLine("Tab Set " + (i + 1) + ":");
11          DescribeTabSetResult dtsr = dtsrs[i];
12          Console.WriteLine("Label: " + dtsr.label);
13          Console.WriteLine("\tLogo URL: " + dtsr.logoUrl);
14          Console.WriteLine("\tTab selected: " + 
15              dtsr.selected);
16            
17          // Describe the tabs for the tab set
18          DescribeTab[] tabs = dtsr.tabs;
19          Console.WriteLine("\tTabs defined: " + tabs.Length);
20            
21          // Iterate through the returned tabs
22          for (int j = 0; j < tabs.Length; j++) {
23              DescribeTab tab = tabs[j];
24              Console.WriteLine("\tTab " + (j + 1) + ":");
25              Console.WriteLine("\t\tName: " + 
26                  tab.sobjectName);
27              Console.WriteLine("\t\tLabel: " + tab.label);
28              Console.WriteLine("\t\tURL: " + tab.url);
29              DescribeColor[] tabColors = tab.colors;
30              // Iterate through tab colors as needed
31              DescribeIcon[] tabIcons = tab.icons;
32              // Iterate through tab icons as needed
33          }
34      }
35    } catch (SoapException e) {
36        Console.WriteLine("An unexpected error has occurred: " +
37                    e.Message + "\n" + e.StackTrace);
38    }
39}

Arguments

None.