describeSearchLayouts()

Retrieves the search result layout configuration for one or more objects.

Syntax

1DescribeSearchLayoutResult[] = binding.describeSearchLayouts(string sObjectType[]);

Usage

Use describeSearchLayouts() to retrieve search layout information for one or more objects. This call is handy when you want to create a custom search results page with the same layout settings as in Salesforce.

Sample

This sample shows how to retrieve the search result layout information for a list of objects.

1public void describeSearchLayoutSample(String[] sObjectTypes) {
2        try {
3            // Get the search layout of Account and Group
4            DescribeSearchLayoutResult[] searchLayoutResults = connection.describeSearchLayouts(sObjectTypes);
5            // Iterate through the results and display the label of each column
6            for (int i = 0; i < sObjectTypes.length; i += 1) {
7                String sObjectType = sObjectTypes[i];
8                DescribeSearchLayoutResult result = searchLayoutResults[i];
9                System.out.println("Top label for search results for " + sObjectType + " is " + result.getLabel() + " and should display " + result.getLimitRows() + " rows");
10                System.out.println("Column labels for search results for " + sObjectType + " are: ");
11                for (DescribeColumn column : result.getSearchColumns()) {
12                    System.out.println(column.getLabel());
13                }
14            }
15        } catch (ConnectionException ce) {
16            ce.printStackTrace();
17        }
18    }

Arguments

Name Type Description
sObjectType string[] The list of objects you want to obtain search result layout configuration for. For example, if the object is a person account, specify Account, or if it is a person contact, specify Contact. The specified values must be valid objects in your organization. For a complete list of standard objects, see Standard Objects.