DescribeLayoutResult

The describeLayout() call returns a DescribeLayoutResult object containing top-level record type information about the passed-in sObjectType, as well as a mapping of record types to layouts. Your client application can traverse this object to retrieve detailed metadata about the layout.

Name Type Description
layouts DescribeLayout[] Layout(s) associated with the specified sObjectType. In general, there is a one-to-one correspondence between layouts and objects. However, in some cases, an object will have multiple layouts in the context of a given user profile.
recordTypeMappings RecordTypeMapping[] Record type mapping(s) available for the user. The objects on a user profile may have multiple record types. All record types are returned, not just those available to the calling user. This allows the client application to display a layout appropriate for a given user profile. For example, suppose User A owns a record, and this record has record type X set. If User B tries to view this record, then the client application can display the record using the layout associated with this record type for User B’s profile (even if the record type is not a available for the user).
recordTypeSelectorRequired boolean If true, a record type selector page is required, if false, use the default record type.

DescribeLayout

Represents a specific layout for the specified sObjectType. Each DescribeLayout is referenced by its unique layout ID and consists of two types of views (represented in this object as arrays of DescribeLayoutSections):

  • Detail view—Read-only display of the object. In a detail layout, certain pieces of information (such as address details) might be aggregated into a single DescribeLayoutItem.
  • Edit view—Editable display of the object. In an edit layout, individual pieces of information (such as an address) will be broken up into separate fields.

An individual DescribeLayout consists of the following fields:

Name Type Description
buttonSection DescribeButtonSection[] Standard and custom button(s) associated with the specified layout.
detailLayoutSections DescribeLayoutSection[] Layout section(s) for the detail view.
editLayoutSections DescribeLayoutSection[] Layout section(s) for the edit view.
id ID Unique ID of this Layout. For information on IDs, see ID Field Type.
relatedList RelatedList[] Related list(s) associated with the specified layout.

DescribeButtonSection

Represents a single standard or custom button in a DescribeLayout.

Name Type Description
isCustom boolean Indicates whether this is a custom button (true) or not (false).
button string Name of the button.
label string Label for the button displayed in the Salesforce user interface.

DescribeLayoutSection

Represents a section of a DescribeLayout and consists of one or more columns and one or more rows (an array of DescribeLayoutRows).

Name Type Description
columns int Number of columns in this DescribeLayoutSection.
heading string Heading text (label) for this DescribeLayoutSection.
layoutRows DescribeLayoutRow[] Array of one or more DescribeLayoutRows.
rows int Number of rows in this DescribeLayoutSection.
useCollapsibleSection boolean Indicates whether this DescribeLayoutSection is a collapsible section, also known as a “twistie” (true), or not (false).
useHeading boolean Indicates whether to use the heading (true) or not (false).

DescribeLayoutRow

Represents a row in a DescribeLayoutSection. A DescribeLayoutRow consists of one or more DescribeLayoutItems. For each DescribeLayoutRow, a DescribeLayoutItem refers either to a specific field or to an “empty” DescribeLayoutItem (a DescribeLayoutItem that contains no DescribeLayoutComponents). An empty DescribeLayoutItem can be returned when a given DescribeLayoutRow is sparse (for example, containing more fields on the right column than on the left column). Where there are gaps in the layout, an empty DescribeLayoutItem is returned as a placeholder.

Name Type Description
layoutItems DescribeLayoutItem[] Refers to either a specific field or to an “empty” LayoutItem (a LayoutItem that contains no DescribeLayoutComponents).
numItems int Number of layoutItems. This information is redundant but, due to a bug in a popular SOAP toolkit, was required to avoid serialization problems.

DescribeLayoutItem

Represents an individual item in a DescribeLayoutRow. A DescribeLayoutItem consists of a set of components (DescribeLayoutComponent), each of which is either a field or a separator. For most fields on a layout, there is only one component per layout item. However, in a display-only view, the DescribeLayoutItem might be a composite of the individual fields (for example, an address can consist of street, city, state, country, and postal code data). On the corresponding edit view, each component of the address field would be split up into separate DescribeLayoutItems.

Name Type Description
editable boolean Indicates whether this DescribeLayoutItem can be edited (true) or not (false).
label string Label text for this DescribeLayoutItem.
layoutComponents DescribeLayoutComponent[] DescribeLayoutComponent(s) for this DescribeLayoutItem.
placeholder boolean Indicates whether this DescribeLayoutItem is a placeholder (true) or not (false). If true, then this DescribeLayoutItem is blank.
required boolean Indicates whether this DescribeLayoutItem is required (true) or not (false). This is useful to know if, for example, you wanted to render required fields in a contrasting color (such as red).

DescribeLayoutComponent

Represents the smallest unit in a layout—a field or a separator. To reference a field for display, a client application uses the following notation to reference a field in the describeSObjects() call: LayoutComponent.fieldName.

Name Type Description
displayLines int The number of vertical lines displayed for a field. Applies to textarea and multi-select picklist fields.
tabOrder int Indicates the tab order for the item in the row.
type LayoutComponentType The LayoutComponentType for this LayoutComponent.
value string Value of this LayoutComponent. The name of the field if the LayoutComponentType value is Field.

LayoutComponentType

Represents the type for a DescribeLayoutComponent. Contains one of these values:
  • Field—Field name. A mapping to the name field on the DescribeSObjectResult.
  • Separator—Separator character, such as a semicolon (:) or slash (/).
  • SControl—Reserved for future use.

RecordTypeMapping

Represents a single record type mapping in the recordTypeMappings field in a DescribeLayoutResult object. This object is a map of valid recordTypeIds to layoutIds. For displaying a detail view, a client application uses this mapping to determine which layout is associated with the record type on the record. For displaying an edit view, a client application uses this mapping to determine which layout to use (and possibly to allow the user to choose between multiple record types); it will also determine the set of available picklist values.

Name Type Description
layoutId ID ID of the layout associated with this record type.
picklistsForRecordType PicklistForRecordType[] Record type picklist(s) mapped to the recordTypeId.
Note
Some fields previously in this result have moved to RecordTypeInfo.

PicklistForRecordType

Represents a single record type picklist in a RecordTypeMapping. The picklistName matches up with the name attribute of each field in the fields array in DescribeSObjectResult. The picklistValues are the set of acceptable values for the recordType.

Name Type Description
picklistName string Name of the picklist.
picklistValues PicklistEntry[] Set of picklist values associated with the recordTypeId in the RecordTypeMapping.

Note: If you retrieve picklistValues, the validFor value is null. If you need the validFor value, get it from the PicklistEntry object obtained from the Field object associated with the DescribeSObjectResult.

RelatedList

Represents a single related list in a DescribeLayoutResult.

Name Type Description
columns RelatedListColumn[] Columns associated with this related list.
You can pair this value with Field to achieve a number of useful tasks, including:
  • To determine whether the field is a name field, in order to present a link to the detail
  • To determine whether the field is sortable, (to allow the user to include it in an ORDER BY clause to sort the rows by the given column
  • To determine whether the field is a currency field, to include the currency symbol or code
isCustom boolean If true, this related list is custom.
field string Name of the field on the related (associated) object that establishes the relationship with the associating object.. For example, for the Contact related list on Account, the value is AccountId.
label string Label for the related list, displayed in the Salesforce user interface.
limitRows int Number of rows to display.
name string Name of the ChildRelationship in the DescribeSObjectResult for the sObjectType which was provided as the argument to DescribeLayout.
sObject string Name of the sObjectType that is the row type for rows within this related list.
sort RelatedListSort[] If not null, the column(s) that should be used to order the related objects.

RelatedListColumn

Represents a single field in a related list returned by DescribeLayoutResult.

Name Type Description
field string API name of the field. This value is always of the form object_type.field_name. For example, if name is Contact.Account.Owner.Alias, then this value is User.Alias.
format string Display in date or dateTime format.
label string Label of the field.
name string SOQL field syntax for the field in relation to the main sObject for the related list. This value may be an expression that uses SOQL relationship query dot notation, or it may use the toLabel() or convertCurrency() format.

For example, if the related list sObjectType is Case, then the value might be Owner.Alias or it might be toLabel(Case.Status).

RelatedListSort

Represents the sorting preference for objects in the related list.

Name Type Description
column string Name of the field that is used to order the related objects.
ascending boolean If true, sort order is ascending. If false, descending.
Although in most cases there is only one RelatedListSort in the array, for some special standard related lists, there is more than one. If there is more than one, the RelatedListSorts are ordered according to how they should be included in a corresponding SOQL query, for example:
 ORDER BY relatedListSort[0].getColumn() DIRECTION, relatedListSort[1].getColumn() DIRECTION
© Copyright 2000-2008 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.