DescribeLayoutResult

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

If you have actions in the publisher enabled in your organization, you can retrieve the layout definition for a global publisher layout by using Global as the sObjectType and null as the recordTypeId.

Tip

A DescribeLayoutResult object has these fields.

NameTypeDescription
   
layoutsDescribeLayout[]Layouts associated with the specified sObjectType. In general, there’s a one-to-one correspondence between layouts and objects. However, in some cases, an object has multiple layouts in the context of a given user profile.
recordTypeMappingsRecordTypeMapping[]Record type mappings available for the user. The objects on a user profile can have multiple record types. All record types are returned, not just those record types available to the calling user. Returning all record types lets the client application display a layout appropriate for a given user profile. For example, suppose that 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 isn’t available for the user).
recordTypeSelectorRequiredbooleanIf 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 DescribeLayoutSection):

  • Detail view—Read-only display of the object. In a detail layout, certain pieces of information (such as address details) can 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) are broken up into separate fields.

An individual DescribeLayout consists of these fields.

NameTypeDescription
buttonLayoutSectionDescribeLayoutButtonSection[]Standard and custom button sections associated with the specified layout.
detailLayoutSectionsDescribeLayoutSection[]Layout sections for the detail view.
editLayoutSectionsDescribeLayoutSection[]Layout sections for the edit view.
feedViewDescribeLayoutFeedView[]Feed view related layout data for a feed-based layout. This field is null for page layouts that aren’t feed-based.
highlightsPanelLayoutSectionDescribeLayoutSection[]Layout sections for the highlights panel view.
multirowEditLayoutSectionsDescribeLayoutSection[]Layout sections for the multiline layout view. This field is available in API version 35.0 and later.
idIDUnique ID of this layout. For information on IDs, see ID Field Type.
quickActionListDescribeQuickActionListResultList of actions associated with the specified layout. This field is available in API version 28.0 and later.
relatedContentRelatedContentMobile Cards section associated with the specified layout. This field is available in API version 29.0 and later.
relatedListsRelatedList[]Related lists associated with the specified layout.
saveOptionsDescribeLayoutSaveOption[]List of save options for the layout.

DescribeLayoutButtonSection 

Represents one of two sections of the layout containing either standard or custom buttons.

NameTypeDescription
detailButtonsDescribeLayoutButton[]Standard or custom buttons associated with the specified button section.

DescribeLayoutButton 

Represents a single standard button, custom button, or custom link in a DescribeLayout.

NameTypeDescription
behaviorWebLinkWindowTypeWhat the button or link does when clicked, such as execute JavaScript or open its content source in a new window. This field is available in API version 31.0 and later.
colorsDescribeColor[]Array of color information for icons associated with this button or link. Each color is associated with a theme. This field is available in API version 32.0 and later.
contentstringThe API name of the Visualforce page or s-control being delivered. This field is available in API version 31.0 and later.
contentSourceWebLinkTypeThe content source of the custom button or link. The contentSource for a standard button that hasn’t been overridden is null. This field is available in API version 31.0 and later.
custombooleanRequired. Indicates whether it’s a custom button or link (true) or not (false).
encodingstringThe type of encoding assigned to the URL called by the button or link. Valid values are:
  • UTF-8—Unicode (UTF-8)
  • ISO-8859-1—General US & Western Europe (ISO-8859–1, ISO-LATIN-1)
  • Shift_JIS—Japanese (Shift-JIS)
  • ISO-2022-JP—Japanese (JIS)
  • EUC-JP—Japanese (EUC-JP)
  • x-SJIS_0213—Japanese (Shift-JIS_2004)
  • ks_c_5601-1987—Korean (ks_c_5601-1987)
  • Big5—Traditional Chinese (Big5)
  • GB2312—Simplified Chinese (GB2312)
  • Big5-HKSCS—Traditional Chinese Hong Kong (Big5–HKSCS)
This field is available in API version 31.0 and later.
heightintThe height (in pixels) when a button or link’s behavior field value is set to newWindow, sidebar, or noSidebar. This field is available in API version 31.0 and later.
iconsDescribeIcon[]Array of icons for this button or link. Each icon is associated with a theme. This field is available in API version 29.0 and later.
labelstringLabel for the button or link displayed in the Salesforce user interface.
menubarbooleanIndicates whether the menu bar displays (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
namestringAPI name of the button or link.
overriddenbooleanRequired. Indicates whether a standard button has been overridden (true) or not (false). This field is available in API version 31.0 and later.
resizeablebooleanIndicates whether the new window is resizeable (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
scrollbarsbooleanIndicates whether scrollbars display (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
showsLocationbooleanIndicates whether the address bar displays (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
showsStatusbooleanIndicates whether the status bar displays (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
toolbarbooleanIndicates whether the toolbars display (true) or not (false) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
urlstringThe URL called by the button or link. This field is null for standard buttons in a related list. This field is available in API version 31.0 and later.
widthintThe width (in pixels) when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.
windowPositionWebLinkPositionIndicates the window position when a button or link’s behavior field value is set to newWindow. This field is available in API version 31.0 and later.

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.

In API version 31.0 and later, DescribeLayoutComponent is extended with FieldLayoutComponent if both the LayoutComponentType value is Field, and the field being described is either the compound field Address or the compound field Person Name.

NameTypeDescription
displayLinesintThe number of vertical lines displayed for a field in the edit view. Applies to textarea and multi-select picklist fields.
tabOrderintIndicates the tab order for the item in the row.
typeLayoutComponentTypeThe LayoutComponentType for this LayoutComponent.
valuestringValue of this LayoutComponent. The name of the field if the LayoutComponentType value is Field. The API name of the canvas app if the LayoutComponentType value is Canvas.

DescribeLayoutFeedFilter 

Represents an individual feed filter option that you can use to filter the feed.

NameTypeDescription
labelstringThe label of the filter.
namestringThe API name of the filter.
typeFeedLayoutFilterType enumStandard feed filter types:
  • AllUpdates
  • FeedItemType

DescribeLayoutFeedView 

Represents the layout of the feed view for a feed-based page layout.

NameTypeDescription
feedFiltersDescribeLayoutFeedFilter[]Lists the feed filter options that are displayed with the feed.

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’s only one component per layout item. However, in a display-only view, the DescribeLayoutItem can 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.

NameTypeDescription
editablebooleanIndicates whether this DescribeLayoutItem can be edited (true) or not (false). This field is available in API version 30.0 and below. It was replaced by the editableForNew and editableForUpdate fields in API version 31.0.
editableForNewbooleanIndicates whether a new DescribeLayoutItem can be edited when creating a record (true) or not (false). This field is available in API version 31.0 and later.
editableForUpdatebooleanIndicates whether an existing DescribeLayoutItem can be edited when editing a record (true) or not (false). This field is available in API version 31.0 and later.
labelstringLabel text for this DescribeLayoutItem.
layoutComponentsDescribeLayoutComponent[]DescribeLayoutComponent for this DescribeLayoutItem.
placeholderbooleanIndicates whether this DescribeLayoutItem is a placeholder (true) or not (false). If true, then this DescribeLayoutItem is blank.
requiredbooleanIndicates whether this DescribeLayoutItem is required (true) or not (false). Useful to know if, for example, you wanted to render required fields in a contrasting color (such as red).
uiBehaviorstringIndicates the DescribeLayoutItem behavior on the specified layout. The value doesn’t reflect user-level or profile-level access. Available values are:
  • Edit—The layout field can be edited but isn’t required.
  • Required—The layout field can be edited and is required.
  • Readonly—The layout field is read-only.
This field applies only to page layouts and mini layouts. For other types of layouts such as compact layouts or quick action layouts, this field is null.

DescribeLayoutRow 

Represents a row in a DescribeLayoutSection. A DescribeLayoutRow consists of one or more DescribeLayoutItem objects. For each DescribeLayoutRow, a DescribeLayoutItem refers either to a specific field or to an “empty” DescribeLayoutItem (a DescribeLayoutItem that contains no DescribeLayoutComponent objects). 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.

NameTypeDescription
layoutItemsDescribeLayoutItem[]Refers to either a specific field or to an empty LayoutItem (a LayoutItem that contains no DescribeLayoutComponent objects).
numItemsintNumber of layoutItems. This information is redundant but, due to a bug in a popular SOAP toolkit, was required to avoid serialization problems.

DescribeLayoutSection 

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

NameTypeDescription
columnsintNumber of columns in this DescribeLayoutSection.
headingstringHeading text (label) for this DescribeLayoutSection.
layoutRowsDescribeLayoutRow[]Array of one or more DescribeLayoutRow objects.
parentLayoutIdIDThe ID of the layout upon which this DescribeLayoutSection resides. This field is available in API version 35.0 and later.
rowsintNumber of rows in this DescribeLayoutSection.
tabOrderstringIndicates the tab order for the fields in the section in the edit view. Valid values are:
  • LeftToRight
  • TopToBottom
This field is available in API version 31.0 and later.
useCollapsibleSectionbooleanIndicates whether this DescribeLayoutSection is a collapsible section, also known as a “twistie” (true), or not (false).
useHeadingbooleanIndicates whether to display the heading (true) or not (false).

DescribeQuickActionListResult 

Represents a list of actions assigned to the page layout. Available in API version 28.0 and later.

NameTypeDescription
quickActionListItemsDescribeQuickActionListResult[]Array of zero or more QuickActionListItemResult objects.

DescribeQuickActionListItemResult 

Represents a QuickAction assigned to the actions list for a page layout. Available in API version 28.0 and later.

NameTypeDescription
colorsDescribeColor[]Array of color information. Each color is associated with a theme. This field is available in API version 29.0 and later.
iconUrlstringThe URL of the icon associated with the action. This icon URL corresponds to the 32x32 icon used for the current Salesforce theme, introduced in Spring ‘10.
iconsDescribeIcon[]Array of icons for this action. Each icon is associated with a theme. This field is available in API version 29.0 and later.
labelstringThe label of the action.
miniIconUrlstringThe URL of the mini-icon associated with the action. This icon URL corresponds to the 16x16 icon used for the current Salesforce theme, introduced in Spring ‘10.
quickActionNamestringThe API name of the action.
targetSobjectTypestringThe API name of the action’s target object.
typestringThe QuickActionType of the action. Valid values are:
  • Create
  • VisualforcePage

LayoutComponentType 

Represents the type for a DescribeLayoutComponent. Contains one of these values:

  • AnalyticsCloud—A CRM Analytics dashboard on the page layout. Available in API version 34.0 and later. See AnalyticsCloudComponent.
  • Canvas—A canvas component on the page layout. This layout component type is available in API version 31.0 and later. See Canvas.
  • CustomLink—A custom link on the page layout. See CustomLinkComponent.
  • EmptySpace—A blank space on the page layout.
  • ExpandedLookup—An Expanded Lookup component in the Mobile Cards section of the page layout.
  • Field—Field name. A mapping to the DescribeSObjectResult field on the describeSObjectResult. See FieldLayoutComponent.
  • ReportChart—A report chart on the page layout. See ReportChartComponent.
  • SControl—Reserved for future use.
  • Separator—Separator character, such as a semicolon (:) or slash (/).
  • VisualforcePage—A Visualforce component on the page layout. See VisualforcePage.

AnalyticsCloudComponent 

When the LayoutComponentType value is AnalyticsCloud, this type contains information about a CRM Analytics dashboard on the page layout.

NameTypeDescription
errorstringAn error string that is populated only when an error occurred in the underlying dashboard.
filterstringDashboard filters for mapping data fields in the dashboard to the object’s fields.
heightstringThe height of the dashboard component, in pixels.
hideOnErrorbooleanIndicates whether to hide a CRM Analytics dashboard component that shows an error (true) or not (false).
showSharingbooleanIf set to true, and the dashboard is shareable, the dashboard shows the Share icon. If set to false, the dashboard doesn’t show the Share icon.
showTitlebooleanIndicates whether to display the title of the dashboard (true) or not (false).
widthstringThe width of the dashboard component, in pixels or percentage.

Canvas 

When the LayoutComponentType value is Canvas, this type contains information about a canvas component on the page layout.

NameTypeDescription
displayLocationstringThe location in the application where the canvas app is being called from.
referenceIdstringThe unique ID of the canvas app definition.
showLabelbooleanIndicates whether to display the label of the Canvas app (true) or not (false).
showScrollbarsbooleanIndicates whether to display scrollbars on the canvas component (true) or not (false).
suggestedHeightstringThe suggested height of the canvas component.
suggestedWidthstringThe suggested width of the canvas component.

CustomLinkComponent 

When the LayoutComponentType value is CustomLink, this type contains information about a single custom link on the page layout.

NameTypeDescription
customLinkDescribeLayoutButtonA single LayoutComponent object of type CustomLink.

FieldLayoutComponent 

Extends the information returned by describeLayoutComponent. When the LayoutComponentType value is Field, and the field being described is an Address or Person Name field, FieldLayoutComponent includes information about the field’s components. When the LayoutComponentType value is Field, and the field being described is a compound field, such as Address or Person Name, FieldLayoutComponent includes information about its components.

Available in API version 31.0 and later.

NameTypeDescription
componentsdescribeLayoutComponent[]Array of zero or more LayoutComponent objects of type Field.
fieldTypeDescribeSObjectResultThe field type.

Sample Code for Usage of FieldLayoutComponent 

1DescribeLayoutComponent layoutComponent = layoutComponents[n];
2        // Look for a component representing the BillingAddress field
3        if (layoutComponent.getType() == LayoutComponentType.Field.toString() &&
4        layoutComponent.getValue().equals("BillingAddress") {
5        // Cast this component as a FieldLayoutComponent
6        DescribeLayoutComponent.FieldLayoutComponent addressFieldComponent =
7(FieldLayoutComponent)layoutComponent;
8        // At this point you can access addressFieldComponent
9FieldLayoutComponent-specific methods such as getComponents() or
10getFieldType()
11        }

ReportChartComponent 

When the LayoutComponentType value is ReportChart, this type contains information about a report chart component on the page layout.

NameTypeDescription
cacheDatastringIndicates whether to use cached data when displaying the chart. When the attribute is set to true, data is cached for 24 hours. When the attribute is set to false, the report is run every time the page is refreshed.
contextFilterableFieldstringUnique API name of the field by which a report chart is filtered to return data relevant to the page. If set, the ID field for the parent object of the page or report type is the chart data filter. The parent object for the report type and the page must match for a chart to return relevant data.
errorstringError string that is populated only when an error occurs in the underlying report.
hideonErrorbooleanIndicates whether to hide a report chart that shows an error (true) or not (false).
includeContextbooleanIf true, filters the report chart to return data that’s relevant to the page.
showTitlebooleanIndicates whether to display the title of the report (true) or not (false).
sizestringThe size of the report chart component. Valid values are:
  • SMALL
  • MEDIUM
  • LARGE

VisualforcePage 

When the LayoutComponentType value is VisualforcePage, this type contains information about a Visualforce page component on the page layout.

NameTypeDescription
showLabelbooleanIndicates whether to display the label of the Visualforce page (true) or not (false).
showScrollbarsbooleanIndicates whether to display scrollbars on the Visualforce page component (true) or not (false).
suggestedHeightstringThe suggested height for the Visualforce page, in pixels.
suggestedWidthbooleanThe suggested width for the Visualforce page, in pixels or a percent value.
urlstringThe URL of the Visualforce page.

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.

NameTypeDescription
picklistNamestringName of the picklist.
picklistValuesPicklistEntry[]Set of picklist values associated with the recordTypeIds in the RecordTypeMapping. Note: If you retrieve picklistValues, the DescribeSObjectResult value is null. If you need the PicklistEntry value, get it from the PicklistEntry object obtained from the Field object associated with the DescribeSObjectResult.

RecordTypeMapping 

Represents a single record type mapping in the recordTypeMappings field in a DescribeLayoutResult object. This object is a map of valid recordTypeIds to layoutId. 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 also determines the set of available picklist values.

NameTypeDescription
availablebooleanIndicates whether this record type is available (true) or not (false). Availability is used to display a list of available record types to the user when they’re creating a record.
defaultRecordTypeMappingbooleanIndicates whether it’s the default record type mapping (true) or not (false).
layoutIdIDID of the layout associated with this record type.
namestringName of this record type.
picklistsForRecordTypePicklistForRecordType[]Record type picklists mapped to the recordTypeIds.
recordTypeIdIDID of this record type.

Some fields previously in this result have moved to DescribeSObjectResult.

Note

RelatedContent 

Represents the Mobile Cards section in a DescribeLayout. Available in API version 29.0 and later.

NameTypeDescription
relatedContentItemsDescribeRelatedContentItem[]An array of items in the Mobile Cards section of the page layout.

DescribeRelatedContentItem 

Represents an individual item in the DescribeRelatedContentItem list. Available in API version 29.0 and later.

NameTypeDescription
describeLayoutItemDescribeLayoutItemAn individual layout item in the Mobile Cards section. Item must be wrapped in a DescribeRelatedContentItem to be added to the Mobile Cards section.

RelatedList 

Represents a single related list in a DescribeLayoutResult.

NameTypeDescription
buttonsDescribeLayoutButton[]Buttons associated with this related list. This field is available in API version 32.0 and later.
columnsRelatedListColumn[]Columns associated with this related list. You can pair this value with DescribeSObjectResult to achieve a number of useful tasks, including determining whether the field is:
  • A name field, in order to present a link to the detail
  • Sortable, (to allow the user to include it in an ORDER BY clause to sort the rows by the given column
  • A currency field, to include the currency symbol or code
custombooleanIf true, this related list is custom.
fieldstringName 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.
labelstringLabel for the related list, displayed in the Salesforce user interface.
limitRowsintNumber of rows to display.
namestringName of the DescribeSObjectResult in the DescribeSObjectResult for the sObjectType that was provided as the argument to DescribeLayout.
sobjectstringName of the sObjectType that is the row type for rows within this related list.
sortRelatedListSort[]If not null, the columns that are used to order the related objects.

RelatedListColumn 

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

NameTypeDescription
fieldstringAPI 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.
fieldApiNamestringSOQL field syntax for the field in relation to the main sObject for the related list. This value is always of the form object_type.field_name. Unlike name, it doesn’t return a value in the Translate Returned SOQL Results format.
formatstringDisplay in date or dateTime format.
labelstringLabel of the field.
lookupIdstringOptional SOQL field syntax to retrieve the lookup ID value for the main related list sObject. This value can be an expression that uses SOQL relationship query dot notation. For example, if the related list sObjectType is Case and the column display value is Owner.Alias, then the lookup ID value would be Owner.Id.
namestringSOQL field syntax for the field in relation to the main sObject for the related list. This value can be an expression that uses SOQL relationship query dot notation, or it can use the Translate Returned SOQL Results or convertCurrency() format. For example, if the related list sObjectType is Case, then the value can be Owner.Alias, or it can be toLabel(Case.Status).

RelatedListSort 

Represents the sorting preference for objects in the related list.

NameTypeDescription
columnstringName of the field that is used to order the related objects.
ascendingbooleanIf true, sort order is ascending. If false, descending.

Although in most cases there’s only one RelatedListSort in the array, for some special standard related lists, there’s more than one RelatedListSort. If an array has multiple RelatedListSorts, they’re ordered according to how they’re included in a corresponding SOQL query. For example:

1ORDER BY relatedListSort[0].getColumn() DIRECTION, relatedListSort[1].getColumn() DIRECTION

DescribeLayoutSaveOption 

Represents the save options for the layout. Save options define the behavior that occurs when objects are created or modified using the given layout. For example, for Cases and Leads, a “UseDefaultAssignmentRule” save option is exposed to control whether assignment rules are applied when Cases or Leads are created or edited.

NameTypeDescription
defaultValuebooleanDefault value for the save option. Controls whether the save option defaults to enabled or not in the Salesforce user interface. For example, for the “UseDefaultAssignmentRule” save option, if defaultValue is true, then by default the system triggers the default assignment rules when an Account, Case, or Lead is created or edited. If false, then the default assignment rules aren’t applied when an Account, Case, or Lead is created or edited, unless the user enables the save option in the Salesforce user interface.
isDisplayedbooleanIf true, then the save option is displayed in the layout. If false, then the save option isn’t displayed in the layout.
labelstringLabel for the save option that is displayed in the Salesforce user interface.
namestringAPI name for the save option.
restHeaderNamestringThe corresponding REST API header for the save option.
soapHeaderNamestringThe corresponding SOAP API header for the save option.

WebLinkPosition 

Represents the window position for a new window opened upon clicking a DescribeLayoutButton. Applies only to custom buttons. Available in API version 31.0 and later. Contains one of these values:

  • fullScreen—The new window opens in a full screen. If this option is selected, any width or height parameters set for the new window are ignored.
  • none—No window position preference is set.
  • topLeft—The new window opens, positioned at the top left of the screen.

WebLinkType 

Represents the content that the custom button delivers. Contains one of these values:

  • javascript
  • page—Visualforce page
  • sControl
  • url

WebLinkWindowType 

Represents the behavior for a DescribeLayoutButton. Applies only to custom buttons. Available in API version 31.0 and later. Contains one of these values:

  • newWindow—The custom button’s content opens in a new browser window.
  • noSidebar—The custom button’s content displays in the existing browser window without a sidebar.
  • onClickJavaScript—Valid only when the DescribeLayoutButton’s contentSource field value is javascript. Clicking the button or link executes JavaScript.
  • replace—The custom button’s content displays in the existing browser window without a sidebar or header.
  • sidebar—The custom button’s content displays in the existing browser window with a sidebar.