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

describeTabSetResult []  = 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.

public void describeTabsSample() {
  try {
    // Describe tabs
    DescribeTabSetResult[] dtsrs = connection.describeTabs();
    System.out.println("There are " + dtsrs.length + 
        " tab sets defined.");
    
    // For each tab set describe result, get some properties 
    for (int i = 0; i < dtsrs.length; i++) {
      System.out.println("Tab Set " + (i + 1) + ":");
      DescribeTabSetResult dtsr = dtsrs[i];
      System.out.println("Label: " + dtsr.getLabel());
      System.out.println("\tLogo URL: " + dtsr.getLogoUrl());
      System.out.println("\tTab selected: " + 
          dtsr.isSelected());
      
      // Describe the tabs for the tab set
      DescribeTab[] tabs = dtsr.getTabs();
      System.out.println("\tTabs defined: " + tabs.length);
      
      // Iterate through the returned tabs
      for (int j = 0; j < tabs.length; j++) {
        DescribeTab tab = tabs[j];
        System.out.println("\tTab " + (j + 1) + ":");
        System.out.println("\t\tName: " + 
            tab.getSobjectName());
        System.out.println("\t\tLabel: " + tab.getLabel());
        System.out.println("\t\tURL: " + tab.getUrl());
        DescribeColor[] tabColors = tab.getColors();
        // Iterate through tab colors as needed
        DescribeIcon[] tabIcons = tab.getIcons();
        // Iterate through tab icons as needed
      }
    }
  } catch (ConnectionException ce) {
    ce.printStackTrace();
  }
}

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.

public void describeTabsSample() {
    try {
      // Describe tabs
      DescribeTabSetResult[] dtsrs = binding.describeTabs();
      Console.WriteLine("There are " + dtsrs.Length + 
          " tab sets defined.");
          
      // For each tab set describe result, get some properties 
      for (int i = 0; i < dtsrs.Length; i++) { Console.WriteLine("Tab Set " + (i + 1) + ":"); DescribeTabSetResult dtsr = dtsrs[i]; Console.WriteLine("Label: " + dtsr.label); Console.WriteLine("\tLogo URL: " + dtsr.logoUrl); Console.WriteLine("\tTab selected: " + dtsr.selected); // Describe the tabs for the tab set DescribeTab[] tabs = dtsr.tabs; Console.WriteLine("\tTabs defined: " + tabs.Length); // Iterate through the returned tabs
          for (int j = 0; j < tabs.Length; j++) { DescribeTab tab = tabs[j]; Console.WriteLine("\tTab " + (j + 1) + ":"); Console.WriteLine("\t\tName: " + tab.sobjectName); Console.WriteLine("\t\tLabel: " + tab.label); Console.WriteLine("\t\tURL: " + tab.url); DescribeColor[] tabColors = tab.colors; // Iterate through tab colors as needed DescribeIcon[] tabIcons = tab.icons; // Iterate through tab icons as needed } } } catch (SoapException e) { Console.WriteLine("An unexpected error has occurred: " + e.Message + "\n" + e.StackTrace); } }

Arguments

None.

Response

describeTabSetResult, DescribeTab

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.