# Get Object Layouts Examples

| AVAILABLE API VERSION |
| --------------------- |
| API v66.0 and later   |

## Get Object Layout

This example gets the layout for the account object.

```sfdocs-code {"lang":"graphql", "title": "Get Account Layout", "src": "" }
{
  uiapi {
    recordLayouts(objectApiName: "Account") {
      edges {
        node {
          id
          layoutType
          mode
          objectApiName
          recordTypeId
          sections {
            heading
            columns
            rows
            collapsible
            layoutRows {
              layoutItems {
                label
                required
                editableForNew
                editableForUpdate
                uiBehavior
                layoutComponents {
                  apiName
                  componentType
                }
              }
            }
          }
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
      totalCount
    }
  }
}
```

## Get Object Layout with a Record Type and Mode

This example gets the layout for the opportunity object with a record type and a mode.

```sfdocs-code {"lang":"graphql", "title": "Get Opportunity Layout with Record Type and Mode", "src": "" }
{
  uiapi {
    recordLayouts(
      objectApiName: "Opportunity"
      recordTypeIds: ["012000000000000AAA"]
      mode: EDIT
      layoutType: FULL
      formFactor: LARGE
    ) {
      edges {
        node {
          id
          mode
          sections {
            heading
            layoutRows {
              layoutItems {
                label
                required
                layoutComponents {
                  apiName
                  componentType
                }
              }
            }
          }
          saveOptions {
            name
            label
            defaultValue
            isDisplayed
          }
        }
      }
    }
  }
}
```

## Get Object Layout with Record Type Overrides

This example gets the case layout with per-record-type mode and form factor overrides.

```sfdocs-code {"lang":"graphql", "title": "Get Case Layout with Config Overrides", "src": "" }
{
  uiapi {
    recordLayouts(
      objectApiName: "Case"
      layoutConfigs: [
        { recordTypeId: "012000000000001AAA", mode: EDIT, formFactor: LARGE }
        { recordTypeId: "012000000000002AAA", mode: VIEW, formFactor: SMALL }
      ]
    ) {
      edges {
        node {
          recordTypeId
          mode
          sections {
            heading
            layoutRows {
              layoutItems {
                label
                layoutComponents {
                  apiName
                  componentType
                }
              }
            }
          }
        }
      }
    }
  }
}
```

## Get Object Layout with Pagination

This example gets the account layout with pagination.

```sfdocs-code {"lang":"graphql", "title": "Get Account Layout with Pagination", "src": "" }
{
  uiapi {
    recordLayouts(objectApiName: "Account", first: 5) {
      edges {
        node { id recordTypeId }
        cursor
      }
      pageInfo {
        hasNextPage
        endCursor
      }
      totalCount
    }
  }
}
```

This example gets the next page.

```sfdocs-code {"lang":"graphql", "title": "Get Next Page of Account Layout", "src": "" }
{
  uiapi {
    recordLayouts(objectApiName: "Account", first: 5, after: "<endCursor>") {
      edges {
        node { id recordTypeId }
        cursor
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}
```

## Get Object Layout with Polymorphic Components

This example gets the account layout with polymorphic components with inline fragments.

```sfdocs-code {"lang":"graphql", "title": "Get Account Layout with Polymorphic Components", "src": "" }
{
  uiapi {
    recordLayouts(objectApiName: "Account") {
      edges {
        node {
          sections {
            layoutRows {
              layoutItems {
                label
                layoutComponents {
                  apiName
                  componentType
                  ... on FieldLayoutComponent {
                    label
                  }
                  ... on VisualforceLayoutComponent {
                    visualforceUrl
                    height
                    width
                    showLabel
                    showScroll
                  }
                  ... on CanvasLayoutComponent {
                    referenceId
                    displayLocation
                    height
                    width
                  }
                  ... on CustomLinkLayoutComponent {
                    customLinkUrl
                    label
                    behavior
                  }
                  ... on ReportLayoutComponent {
                    reportId
                    filter
                    size
                    showTitle
                    hideOnError
                    cacheData
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```

## See Also

[Get Object Layouts](/docs/platform/graphql/guide/query-record-layouts.md)
