describeTheme()
構文
1DescribeThemeResult = connection.describeTheme(string sObjectType[]);使用方法
describeTheme() を使用して、指定されたオブジェクト配列の現在のテーマ情報を取得します。テーマ情報は、特定のテーマに使用される、Salesforce 内のオブジェクトの色およびアイコンで構成されています。たとえば、Merchandise__c オブジェクトは通常の Salesforce アプリケーションテーマには「computer32」アイコンと、赤色の主タブ色を使用し、モバイルタッチスクリーンバージョンの Salesforce には別のセットの色とアイコンを使用できます。
オブジェクト配列ではなく、null を渡すと、describeTheme() は、テーマの色とアイコンを使用する組織内のすべてのオブジェクトのテーマ情報を返します。
組織のデータのテーマ情報を取得するには、条件を満たすアクセス権限でクライアントアプリケーションにログインする必要があります。詳細は、「データアクセスに影響する要素」を参照してください。
describeTheme() は、API バージョン 29.0 以降で使用できます。
サンプル
この Java のサンプルでは、describeTheme() をコールして取引先と取引先責任者のテーマ情報を取得した後、取得したテーマ情報を反復処理します。
1public static void describeThemeExample() {
2 try {
3 // Get current themes
4 DescribeTheme themeResult = connection.describeTheme(
5 new String[] { "Account", "Contact" });
6 DescribeThemeItem[] themeItems = themeResult.getThemeItems();
7 for (int i = 0; i < themeItems.length; i++) {
8 DescribeThemeItem themeItem = themeItems[i];
9 System.out.println("Theme information for object " + themeItem.getName());
10 // Get color and icon info for each themeItem
11 DescribeColor colors[] = themeItem.getColors();
12 System.out.println(" Number of colors: " + colors.length);
13 int k;
14 for (k = 0; k < colors.length; k++) {
15 DescribeColor color = colors[k];
16 System.out.println(" For Color #" + k + ":");
17 System.out.println(" Web RGB Color: " + color.getColor());
18 System.out.println(" Context: " + color.getContext());
19 System.out.println(" Theme: " + color.getTheme());
20 }
21 DescribeIcon icons[] = themeItem.getIcons();
22 System.out.println(" Number of icons: " + icons.length);
23 for (k = 0; k < icons.length; k++) {
24 DescribeIcon icon = icons[k];
25 System.out.println(" For Icon #" + k + ":");
26 System.out.println(" ContentType: " + icon.getContentType());
27 System.out.println(" Height: " + icon.getHeight());
28 System.out.println(" Theme: " + icon.getTheme());
29 System.out.println(" URL: " + icon.getUrl());
30 System.out.println(" Width: " + icon.getWidth());
31 }
32 }
33 } catch (ConnectionException ce) {
34 ce.printStackTrace();
35 }
36}