Newer Version Available

This content describes an older version of this product. View Latest

describePrimaryCompactLayouts()

Retrieves metadata about the primary compact layout for each of the specified object types.
Information returned is limited to 100 objects.

Syntax

1DescribeCompactLayout[] primaryCompactLayouts = connection.describePrimaryCompactLayouts(string[] sObjectType)

Usage

Use this call to retrieve information about the primary compact layout for the given object types. This call returns metadata about a given primary compact layout. For more information about compact layouts, see Salesforce Help.

Sample Code—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}

Arguments

Name Type Description
sObjectTypes string[] An array of one or more objects. The specified values must be valid objects for your organization.