Get Object Layouts

AVAILABLE API VERSION
API v66.0 and later

The recordLayouts field of LayoutConnection type returns page layout metadata for objects. The response includes sections, rows, items, and polymorphic components, matching the User Interface REST API Record Layout.

Pass in recordLayouts in the uiapi field. For example, use objectApiName: ["Account"] to return the page layout metadata for the account object.

Query recordLayouts Field
1{
2  uiapi {
3    recordLayouts(objectApiName: ["Account"]) {
4      # fields
5    }
6  }
7}

Record Layout Schema 

Query recordLayouts by using this schema.

Query recordLayouts
1type UIAPI {
2   recordLayouts(
3      objectApiName: String!
4      recordTypeIds: [Id!]
5      layoutConfigs: [LayoutConfig!]
6      layoutType = "FULL": LayoutType
7      formFactor = "LARGE": FormFactor
8      mode = "VIEW": LayoutMode
9      first: Int
10      after: String
11   ): LayoutConnection
12}
13
14input LayoutConfig {recordTypeId: ID!, formFactor: FormFactor, mode: LayoutMode
15}

The recordLayouts type has these arguments.

  • objectApiName - The object API name of a supported object. This argument is required.

  • recordTypeIds - A list of up to 10 record type IDs.

  • layoutConfigs - An array of layoutConfig types with these arguments to request different form factor and mode combinations per record type.

    • recordTypeId - A record type ID.
    • formFactor - Form factor that the FormFactor enum provides for the record type layout. Default value is LARGE.
    • mode - Mode that the LayoutMode enum provides for the record type layout. Default value is VIEW.
  • layoutType - Layout type that the LayoutType enum provides. Default value is FULL.

  • formFactor - Default form factor that the FormFactor enum provides for all layouts. Default value is LARGE.

  • mode - Default mode that the LayoutMode enum provides for all layouts. Default value is VIEW.

  • first - Number of layouts per page. Specify up to 10 layouts. Default value is 10.

  • after - Returns the results after the given cursor. See Paginate Results.

LayoutConnection Type 

The LayoutConnection type represents a result set of record layouts that ties together the layouts and page info. Layouts are paginated by record type, with each edge representing one layout for one record type. See Paginate Results.

LayoutConnection Type
1type LayoutConnection {
2  edges: [LayoutEdge!]
3  pageInfo: PageInfo!
4  totalCount: Int!
5}

The LayoutConnection type contains these fields.

  • edges - A list of LayoutEdge types.
  • pageInfo - Information about the relative location in the result set.
  • totalCount - The number of records that are queried.

LayoutEdge Type 

The LayoutEdge type ties together the record and its cursor.

LayoutEdge Type
1type LayoutEdge {
2  node: Layout
3  cursor: String!
4}

The LayoutEdge type contains these fields.

  • node - One layout for one record type.
  • cursor - An opaque string used to page directly to this item in the result set.

Layout Type 

The Layout type is the layout for the record type, matching the User Interface Record Layout representation.

Layout Type
1type Layout {
2  id: ID
3  layoutType: LayoutType
4  mode: LayoutMode
5  objectApiName: String!
6  recordTypeId: ID
7  saveOptions: [LayoutSaveOption!]
8  sections: [LayoutSection!]
9}

The Layout type contains these fields.

  • id - ID of the layout.
  • layoutType - Layout type that the LayoutType enum provides.
  • mode - Mode that the LayoutMode enum provides.
  • objectApiName - API name of the object that the layout is associated with.
  • recordTypeId - Record type ID.
  • saveOptions - A list of save options for the layout.
  • sections - A list of layout sections.

LayoutSaveOption Type 

The LayoutSaveOption type is the save option for a record layout. Save options define 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.

LayoutSaveOption Type
1type LayoutSaveOption {
2  defaultValue: Boolean!
3  isDisplayed: Boolean!
4  label: String!
5  name: String!
6  restHeaderName: String
7  soapHeaderName: String
8}

The LayoutSaveOption type contains these fields.

  • defaultValue - Indicates whether the save option defaults to enabled.
  • isDisplayed - Indicates whether the save option is displayed in the layout.
  • label - Label for the save option.
  • name - API name for the save option.
  • restHeaderName - REST API header for the save option.
  • soapHeaderName - SOAP API header for the save option.

LayoutSection Type 

The LayoutSection type is a section in a record layout.

LayoutSection Type
1type LayoutSection {
2  collapsible: Boolean!
3  columns: Int!
4  heading: String
5  id: ID
6  layoutRows: [LayoutRow!]
7  rows: Int!
8  tabOrder: TabOrder
9  useHeading: Boolean!
10}

The LayoutSection type contains these fields.

  • collapsible - Indicates whether the section can be collapsed.
  • columns - Number of columns in the section.
  • heading - Heading text for the section.
  • id - ID of the section.
  • layoutRows - List of rows in the section.
  • rows - Number of rows in the section.
  • tabOrder - Tab order that the TabOrder enum provides for the section.
  • useHeading - Indicates whether to display the heading text.

LayoutRow Type 

The LayoutRow type is a row in a record layout.

LayoutRow Type
1type LayoutRow {
2  layoutItems: [LayoutItem!]
3}

The LayoutRow type contains these fields.

  • layoutItems - A collection of items in the row, from left to right. Might not extend to the last column.

LayoutItem Type 

The LayoutItem type is an item in a record layout.

LayoutItem Type
1type LayoutItem {
2  editableForNew: Boolean!
3  editableForUpdate: Boolean!
4  label: String!
5  layoutComponents: [LayoutComponent!]
6  lookupIdApiName: String
7  required: Boolean!
8  sortable: Boolean!
9  uiBehavior: UiBehavior
10}

The LayoutItem type contains these fields.

  • editableForNew - Indicates whether the item can be edited when creating a record.
  • editableForUpdate - Indicates whether the item can be edited when updating a record.
  • label - Text label for the item.
  • layoutComponents - List of components that make up the item.
  • lookupIdApiName - ID field name of a lookup field.
  • required - Indicates whether the field is required in a layout when creating or updating a record. This information is useful if you want to render required fields with a different treatment, such as a red outline.
  • sortable - Indicates whether the item is sortable.
  • uiBehavior - UI behavior that the UiBehavior enum provides for the page and mini layout item. For other types of layouts, such as compact or quick action, the field is null. The value doesn’t reflect user-level or profile-level access.

LayoutComponent Interface 

The LayoutComponent interface is polymorphic with six concrete implementations. The componentType field for each concrete implementation indicates the type.

LayoutComponent Interface
1interface LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4}

The LayoutComponent interface contains these fields.

  • apiName - API name of the component.
  • componentType - Layout component type that the LayoutComponentType enum provides.

CanvasLayoutComponent 

The CanvasLayoutComponent is a canvas component on a record layout.

CanvasLayoutComponent Type
1type CanvasLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4  displayLocation: String
5  height: String
6  referenceId: ID
7  showScroll: Boolean
8  width: String
9}

The CanvasLayoutComponent type contains these fields.

  • apiName - API name of the canvas app.
  • componentType - Value is CANVAS.
  • displayLocation - Location in the application that is calling the canvas app.
  • height - Height of the component.
  • referenceId - Unique ID of the canvas app definition.
  • showScroll - Indicates whether to show the scroll bar on the canvas component.
  • width - Width of the component.

CustomLinkLayoutComponent 

The CustomLinkLayoutComponent is a custom link component on a record layout.

CustomLinkLayoutComponent Type
1type CustomLinkLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4  behavior: WeblinkWindowType
5  customLinkUrl: String
6  label: String
7}

The CustomLinkLayoutComponent type contains these fields.

  • apiName - If a field powers this component, the API name of the field.
  • componentType - Value is CUSTOM_LINK.
  • behavior - Link behavior that the WeblinkWindowType enum provides.
  • customLinkUrl - Custom link URL.
  • label - Custom link label.

EmptySpaceLayoutComponent 

The EmptySpaceLayoutComponent is an empty placeholder space.

EmptySpaceLayoutComponent Type
1type EmptySpaceLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4}

The EmptySpaceLayoutComponent type contains these fields.

  • apiName - If the component is powered by a field, the API name of the field.
  • componentType - Value is EMPTY_SPACE.

FieldLayoutComponent 

The FieldLayoutComponent is a standard field on a record layout.

FieldLayoutComponent Type
1type FieldLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4  label: String
5}

The FieldLayoutComponent type contains these fields.

  • apiName - API name of the field.
  • componentType - Value is FIELD.
  • label - Label of the field.

ReportLayoutComponent 

The ReportLayoutComponent is an embedded report chart component on a record layout.

ReportLayoutComponent Type
1type ReportLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4  cacheData: Boolean
5  error: String
6  filter: String
7  hideOnError: Boolean
8  placeholder: String
9  reportId: ID
10  showTitle: Boolean
11  size: String
12}

The ReportLayoutComponent type contains these fields.

  • apiName - If a field powers this component, the API name of the field.
  • componentType - Value is REPORT_CHART.
  • cacheData - Indicates whether to cache data.
  • error - Error message.
  • filter - Filter for the report.
  • hideOnError - Indicates whether to hide the component if there’s an error.
  • placeholder - Placeholder for the report.
  • reportId - Component’s report ID.
  • showTitle - Indicates whether to show the report’s title.
  • size - Size of the component.

VisualforceLayoutComponent 

The VisualforceLayoutComponent is an embedded Visualforce component on a record layout.

VisualforceLayoutComponent Type
1type VisualforceLayoutComponent implements LayoutComponent {
2  apiName: String
3  componentType: LayoutComponentType!
4  height: String
5  showLabel: Boolean
6  showScroll: Boolean
7  visualforceUrl: String
8  width: String
9}

The VisualforceLayoutComponent type contains these fields.

  • apiName - If a field powers this component, the API name of the field.
  • componentType - Value is VISUALFORCE_PAGE.
  • height - Height of the component.
  • showLabel - Indicates whether to show the section label with the component.
  • showScroll - Indicates whether to show the scroll bar on the component.
  • visualforceUrl - Visualforce URL.
  • width - Width of the component.

PageInfo Type 

The PageInfo type contains relative position information, which shows where in the entire result set the current page is located. The PageInfo type is the same for every Connection type. See PageInfo Type.

Enumeration Types 

The recordLayouts type has these enumerations.

FormFactor 

The FormFactor enumeration specifies the layout display size for the record. The LARGE value is for desktop, the MEDIUM value is for tablet, and the SMALL value is for phone.

FormFactor Enum
1enum FormFactor {
2  LARGE
3  MEDIUM
4  SMALL
5}

LayoutComponentType 

The LayoutComponementType enumeration indicates the layout component type.

LayoutComponentType Enum
1enum LayoutComponentType {
2  CANVAS
3  CUSTOM_LINK
4  EMPTY_SPACE
5  FIELD
6  REPORT_CHART
7  VISUALFORCE_PAGE
8}

LayoutMode 

The LayoutMode enumeration specifies the access mode for the record. The value determines which fields to get from a layout. Layouts have different fields for create, edit, and view modes. For example, formula fields are rendered in view mode, but not in create mode because they’re calculated at run time, like formulas in a spreadsheet.

LayoutMode Enum
1enum LayoutMode {
2  CREATE
3  EDIT
4  VIEW
5}

LayoutType 

The LayoutType enumeration specifies the layout type for the record. The COMPACT value indicates a layout that contains a record’s key fields only.

LayoutType Enum
1enum LayoutType {
2  FULL
3  COMPACT
4}

TabOrder 

The TabOrder enumeration specifies the tab order for the items in a section.

TabOrder Enum
1enum TabOrder {
2  LEFT_RIGHT
3  TOP_DOWN
4}

UiBehavior 

The UiBehavior enumeration indicates the layout item behavior on page and mini layouts. The value doesn’t reflect user-level or profile-level access.

UiBehavior Enum
1enum UiBehavior {
2  EDIT
3  REQUIRED
4  READONLY
5}

WeblinkWindowType 

The WeblinkWindowType enumeration indicates how a link behaves on open.

WeblinkWindowType Enum
1enum WeblinkWindowType {
2  NEW_WINDOW
3  NO_SIDEBAR
4  ONCLICK_JAVASCRIPT
5  REPLACE
6  SIDEBAR
7}

See Also 

Get Record Layout Examples