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.

{
  uiapi {
    recordLayouts(objectApiName: ["Account"]) {
      # fields
    }
  }
}

Record Layout Schema

Query recordLayouts by using this schema.

type UIAPI {
   recordLayouts(
      objectApiName: String!
      recordTypeIds: [Id!]
      layoutConfigs: [LayoutConfig!]
      layoutType = "FULL": LayoutType
      formFactor = "LARGE": FormFactor
      mode = "VIEW": LayoutMode
      first: Int
      after: String
   ): LayoutConnection
}

input LayoutConfig {recordTypeId: ID!, formFactor: FormFactor, mode: LayoutMode
}

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.

type LayoutConnection {
  edges: [LayoutEdge!]
  pageInfo: PageInfo!
  totalCount: Int!
}

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.

type LayoutEdge {
  node: Layout
  cursor: String!
}

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.

type Layout {
  id: ID
  layoutType: LayoutType
  mode: LayoutMode
  objectApiName: String!
  recordTypeId: ID
  saveOptions: [LayoutSaveOption!]
  sections: [LayoutSection!]
}

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.

type LayoutSaveOption {
  defaultValue: Boolean!
  isDisplayed: Boolean!
  label: String!
  name: String!
  restHeaderName: String
  soapHeaderName: String
}

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.

type LayoutSection {
  collapsible: Boolean!
  columns: Int!
  heading: String
  id: ID
  layoutRows: [LayoutRow!]
  rows: Int!
  tabOrder: TabOrder
  useHeading: Boolean!
}

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.

type LayoutRow {
  layoutItems: [LayoutItem!]
}

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.

type LayoutItem {
  editableForNew: Boolean!
  editableForUpdate: Boolean!
  label: String!
  layoutComponents: [LayoutComponent!]
  lookupIdApiName: String
  required: Boolean!
  sortable: Boolean!
  uiBehavior: UiBehavior
}

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.

interface LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
}

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.

type CanvasLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
  displayLocation: String
  height: String
  referenceId: ID
  showScroll: Boolean
  width: String
}

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.

type CustomLinkLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
  behavior: WeblinkWindowType
  customLinkUrl: String
  label: String
}

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.

type EmptySpaceLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
}

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.

type FieldLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
  label: String
}

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.

type ReportLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
  cacheData: Boolean
  error: String
  filter: String
  hideOnError: Boolean
  placeholder: String
  reportId: ID
  showTitle: Boolean
  size: String
}

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.

type VisualforceLayoutComponent implements LayoutComponent {
  apiName: String
  componentType: LayoutComponentType!
  height: String
  showLabel: Boolean
  showScroll: Boolean
  visualforceUrl: String
  width: String
}

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.

enum FormFactor {
  LARGE
  MEDIUM
  SMALL
}

LayoutComponentType

The LayoutComponementType enumeration indicates the layout component type.

enum LayoutComponentType {
  CANVAS
  CUSTOM_LINK
  EMPTY_SPACE
  FIELD
  REPORT_CHART
  VISUALFORCE_PAGE
}

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.

enum LayoutMode {
  CREATE
  EDIT
  VIEW
}

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.

enum LayoutType {
  FULL
  COMPACT
}

TabOrder

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

enum TabOrder {
  LEFT_RIGHT
  TOP_DOWN
}

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.

enum UiBehavior {
  EDIT
  REQUIRED
  READONLY
}

WeblinkWindowType

The WeblinkWindowType enumeration indicates how a link behaves on open.

enum WeblinkWindowType {
  NEW_WINDOW
  NO_SIDEBAR
  ONCLICK_JAVASCRIPT
  REPLACE
  SIDEBAR
}

See Also

Get Record Layout Examples