describeTabs()
ページ上部の Force.com アプリケーションメニューに表示される、ログインユーザが使用できる標準アプリケーションおよびカスタムアプリケーションに関する情報を返します。アプリケーションは、アプリケーション機能を提供するために 1 つの単位として機能するタブのセットです。たとえば、標準 Salesforce アプリケーションとして「セールス」と「コールセンター」があります。
構文
1describeTabSetResult [] = connection.describeTabs();使用方法
ログインユーザがアクセスできる標準アプリケーションとカスタムアプリケーションの情報を取得するのに、describeTabs() コールを使用します。describeTabs() コールは、アプリケーションを別のユーザインターフェースで表示するのに必要な最小限のメタデータを返します。通常このコールは、Salesforce データを別のユーザインターフェースで表示するためにパートナーアプリケーションからコールされます。
各タブに対するコールでは、タブ名、タブに表示されるメインの sObject、タブを参照する URL のほか、そのタブがカスタムタブかどうかといった情報が返されます。[すべてのタブ] タブおよび [Lightning ページ] タブは、タブリストには含まれません。
サンプルコード —Java
このサンプルでは、describeTabs() をコールします。これは、タブセットの結果の配列を返します。次に、アプリケーションを表すタブセットの結果ごとに、プロパティの一部を取得し、このアプリケーションのすべてのタブを取得します。このサンプルでは、取得したすべてのプロパティをコンソールに書き込みます。
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void describeTabsSample() {
18 try {
19 // Describe tabs
20 DescribeTabSetResult[] dtsrs = connection.describeTabs();
21 System.out.println("There are " + dtsrs.length +
22 " tab sets defined.");
23
24 // For each tab set describe result, get some properties
25 for (int i = 0; i < dtsrs.length; i++) {
26 System.out.println("Tab Set " + (i + 1) + ":");
27 DescribeTabSetResult dtsr = dtsrs[i];
28 System.out.println("Label: " + dtsr.getLabel());
29 System.out.println("\tLogo URL: " + dtsr.getLogoUrl());
30 System.out.println("\tTab selected: " +
31 dtsr.isSelected());
32
33 // Describe the tabs for the tab set
34 DescribeTab[] tabs = dtsr.getTabs();
35 System.out.println("\tTabs defined: " + tabs.length);
36
37 // Iterate through the returned tabs
38 for (int j = 0; j < tabs.length; j++) {
39 DescribeTab tab = tabs[j];
40 System.out.println("\tTab " + (j + 1) + ":");
41 System.out.println("\t\tName: " +
42 tab.getSobjectName());
43 System.out.println("\t\tLabel: " + tab.getLabel());
44 System.out.println("\t\tURL: " + tab.getUrl());
45 DescribeColor[] tabColors = tab.getColors();
46 // Iterate through tab colors as needed
47 DescribeIcon[] tabIcons = tab.getIcons();
48 // Iterate through tab icons as needed
49 }
50 }
51 } catch (ConnectionException ce) {
52 ce.printStackTrace();
53 }
54}サンプルコード —C#
このサンプルでは、describeTabs() をコールします。これは、タブセットの結果の配列を返します。次に、アプリケーションを表すタブセットの結果ごとに、プロパティの一部を取得し、このアプリケーションのすべてのタブを取得します。このサンプルでは、取得したすべてのプロパティをコンソールに書き込みます。
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void describeTabsSample() {
18 try {
19 // Describe tabs
20 DescribeTabSetResult[] dtsrs = binding.describeTabs();
21 Console.WriteLine("There are " + dtsrs.Length +
22 " tab sets defined.");
23
24 // For each tab set describe result, get some properties
25 for (int i = 0; i < dtsrs.Length; i++) {
26 Console.WriteLine("Tab Set " + (i + 1) + ":");
27 DescribeTabSetResult dtsr = dtsrs[i];
28 Console.WriteLine("Label: " + dtsr.label);
29 Console.WriteLine("\tLogo URL: " + dtsr.logoUrl);
30 Console.WriteLine("\tTab selected: " +
31 dtsr.selected);
32
33 // Describe the tabs for the tab set
34 DescribeTab[] tabs = dtsr.tabs;
35 Console.WriteLine("\tTabs defined: " + tabs.Length);
36
37 // Iterate through the returned tabs
38 for (int j = 0; j < tabs.Length; j++) {
39 DescribeTab tab = tabs[j];
40 Console.WriteLine("\tTab " + (j + 1) + ":");
41 Console.WriteLine("\t\tName: " +
42 tab.sobjectName);
43 Console.WriteLine("\t\tLabel: " + tab.label);
44 Console.WriteLine("\t\tURL: " + tab.url);
45 DescribeColor[] tabColors = tab.colors;
46 // Iterate through tab colors as needed
47 DescribeIcon[] tabIcons = tab.icons;
48 // Iterate through tab icons as needed
49 }
50 }
51 } catch (SoapException e) {
52 Console.WriteLine("An unexpected error has occurred: " +
53 e.Message + "\n" + e.StackTrace);
54 }
55}引数
なし。