この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

describeCompactLayouts()

指定されたオブジェクト種別のコンパクトレイアウトに関するメタデータを取得します。

構文

1DescribeCompactLayoutsResult compactLayoutResult = connection.describeCompactLayouts(string sObjectType, ID[] recordTypeId);

使用方法

このコールを使用し、指定されたオブジェクト種別のコンパクトレイアウトに関する情報を取得します。このコールは、レコードタイプの対応付けを含む、指定されたコンパクトレイアウトに関するメタデータを返します。コンパクトレイアウトについての詳細は、Salesforce オンラインヘルプを参照してください。

サンプルコード —Java

このサンプルでは、取引先 sObject のコンパクトレイアウトを取得する方法を示します。記述する sObject 種別の名前を使用して、describeCompactLayouts() をコールします。コンパクトレイアウトの取得後、各コンパクトレイアウトで検出された画像、項目、およびアクションボタンが出力されます。次に、オブジェクトのシステムデフォルトコンパクトレイアウト、コンパクトレイアウトへのレコードタイプの対応付け情報の順に出力されます。

1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void testDescribeCompactLayoutsSample() {
18    try {
19        String objectToDescribe = "Account";
20        DescribeCompactLayoutsResult compactLayoutResult = connection
21                .describeCompactLayouts(objectToDescribe, null);
22        System.out.println("There are " + compactLayoutResult.getCompactLayouts().length
23                + " compact layouts for the " + objectToDescribe + " object.");
24
25        // Get all the compact layouts for the sObject
26        for (int i = 0; i < compactLayoutResult.getCompactLayouts().length; i++) {
27            DescribeCompactLayout cLayout = compactLayoutResult.getCompactLayouts()[i];
28            System.out.println(" There is a compact layout with name: " + cLayout.getName());
29            DescribeLayoutItem[] fieldItems = cLayout.getFieldItems();
30            System.out.println(" There are " + fieldItems.length + " fields in this compact layout.");
31
32            // Write field items
33            for (int j = 0; j < fieldItems.length; j++) {
34                System.out.println(j + " This compact layout has a field with name: " + fieldItems[j].getLabel());
35            }
36
37            DescribeLayoutItem[] imageItems = cLayout.getImageItems();
38            System.out.println(" There are " + imageItems.length + " image fields in this compact layout.");
39
40            // Write the image items
41            for (int j = 0; j < imageItems.length; j++) {
42                System.out.println(j + " This compact layout has an image field with name: " + imageItems[j].getLabel());
43            }
44
45            DescribeLayoutButton[] actions = cLayout.getActions();
46            System.out.println(" There are " + actions.length + " buttons in this compact layout.");
47
48            // Write the action buttons
49            for (int j = 0; j < actions.length; j++) {
50                System.out.println(j + " This compact layout has a button with name: " + actions[j].getLabel());
51            }
52
53            System.out.println("This object's default compact layout is: "
54                    + compactLayoutResult.getDefaultCompactLayoutId());
55
56            RecordTypeCompactLayoutMapping[] mappings = compactLayoutResult.getRecordTypeCompactLayoutMappings();
57            System.out.println("There are " + mappings.length + " record type to compact layout mapping for the "
58                    + objectToDescribe + " object.");
59            for (int j = 0; j < mappings.length; j++) {
60                System.out.println(j + " Record type " + mappings[j].getRecordTypeId()
61                        + " is mapped to compact layout " + mappings[j].getCompactLayoutId());
62            }
63        }
64
65    } catch (ConnectionException ce) {
66        ce.printStackTrace();
67    }
68
69}
70

引数

名前 説明
sObjectType string 指定された値は、組織で有効なオブジェクトである必要があります。オブジェクトが個人取引先である場合は Account を指定し、個人取引先責任者である場合は Contact を指定します。
recordTypeId ID[] 任意で指定できるパラメータ。返されるコンパクトレイアウトデータを、指定されたレコードタイプに制限します。