Newer Version Available
describeTabs()
Returns information about the Salesforce Classic standard and custom apps available to the logged-in user, as listed in the Lightning Platform app menu at the top of the page. An app is a set of tabs that works as a unit to provide application functionality. For example, two of the standard Salesforce apps are “Sales” and “Service.”
Syntax
1describeTabSetResult [] = connection.describeTabs();Usage
Use the describeTabs() call to obtain information about the Salesforce Classic 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.
For each tab, the call returns the tab name, the primary sObject that’s displayed on the tab, whether it’s a custom tab, and the URL for viewing that tab. Note that the “All Tabs” tab and Lightning page tabs aren’t 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 a Salesforce Classic app, it retrieves some of its properties and gets all the tabs for this app. It writes all retrieved properties to the console.
1public 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 a Salesforce Classic app, it retrieves some of its properties and gets all the tabs for this app. It writes all retrieved properties to the console.
1public 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.