describePrimaryCompactLayouts()
構文
1DescribeCompactLayout[] primaryCompactLayouts = connection.describePrimaryCompactLayouts(string[] sObjectType)使用方法
このコールを使用し、指定されたオブジェクト種別の主コンパクトレイアウトに関する情報を取得します。このコールは、指定された主コンパクトレイアウトに関するメタデータを返します。コンパクトレイアウトについての詳細は、Salesforce ヘルプを参照してください。
サンプルコード — Java
1public void testDescribePrimaryCompactLayoutsSample() {
2 try {
3 String[] objectsToDescribe = new String[] {"Account","Lead"};
4 DescribeCompactLayout[] primaryCompactLayouts = connection.describePrimaryCompactLayouts(objectsToDescribe);
5
6 for (int i = 0; i < primaryCompactLayouts.length; i++) {
7 DescribeCompactLayout cLayout = primaryCompactLayouts[i];
8 System.out.println(" There is a compact layout with name: " + cLayout.getName());
9
10 // Write the objectType
11 System.out.println(" This compact layout is the primary compact layout for: " + cLayout.getObjectType());
12
13 DescribeLayoutItem[] fieldItems = cLayout.getFieldItems();
14 System.out.println(" There are " + fieldItems.length + " fields in this compact layout.");
15
16 // Write field items
17 for (int j = 0; j < fieldItems.length; j++) {
18 System.out.println(j + " This compact layout has a field with name: " + fieldItems[j].getLabel());
19 }
20
21 DescribeLayoutItem[] imageItems = cLayout.getImageItems();
22 System.out.println(" There are " + imageItems.length + " image fields in this compact layout.");
23
24 // Write the image items
25 for (int j = 0; j < imageItems.length; j++) {
26 System.out.println(j + " This compact layout has an image field with name: " + imageItems[j].getLabel());
27 }
28
29 DescribeLayoutButton[] actions = cLayout.getActions();
30 System.out.println(" There are " + actions.length + " buttons in this compact layout.");
31
32 // Write the action buttons
33 for (int j = 0; j < actions.length; j++) {
34 System.out.println(j + " This compact layout has a button with name: " + actions[j].getLabel());
35 }
36 }
37
38 } catch (ConnectionException ce) {
39 ce.printStackTrace();
40 }
41}引数
| 名前 | 型 | 説明 |
|---|---|---|
| sObjectTypes | string[] | 1 つ以上のオブジェクトの配列。指定する値は、組織で有効なオブジェクトである必要があります。 |