Get Object Layouts Examples

AVAILABLE API VERSION
API v66.0 and later

Get Object Layout 

This example gets the layout for the account object.

Get Account Layout
1{
2  uiapi {
3    recordLayouts(objectApiName: "Account") {
4      edges {
5        node {
6          id
7          layoutType
8          mode
9          objectApiName
10          recordTypeId
11          sections {
12            heading
13            columns
14            rows
15            collapsible
16            layoutRows {
17              layoutItems {
18                label
19                required
20                editableForNew
21                editableForUpdate
22                uiBehavior
23                layoutComponents {
24                  apiName
25                  componentType
26                }
27              }
28            }
29          }
30        }
31      }
32      pageInfo {
33        hasNextPage
34        endCursor
35      }
36      totalCount
37    }
38  }
39}

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.

Get Opportunity Layout with Record Type and Mode
1{
2  uiapi {
3    recordLayouts(
4      objectApiName: "Opportunity"
5      recordTypeIds: ["012000000000000AAA"]
6      mode: EDIT
7      layoutType: FULL
8      formFactor: LARGE
9    ) {
10      edges {
11        node {
12          id
13          mode
14          sections {
15            heading
16            layoutRows {
17              layoutItems {
18                label
19                required
20                layoutComponents {
21                  apiName
22                  componentType
23                }
24              }
25            }
26          }
27          saveOptions {
28            name
29            label
30            defaultValue
31            isDisplayed
32          }
33        }
34      }
35    }
36  }
37}

Get Object Layout with Record Type Overrides 

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

Get Case Layout with Config Overrides
1{
2  uiapi {
3    recordLayouts(
4      objectApiName: "Case"
5      layoutConfigs: [
6        { recordTypeId: "012000000000001AAA", mode: EDIT, formFactor: LARGE }
7        { recordTypeId: "012000000000002AAA", mode: VIEW, formFactor: SMALL }
8      ]
9    ) {
10      edges {
11        node {
12          recordTypeId
13          mode
14          sections {
15            heading
16            layoutRows {
17              layoutItems {
18                label
19                layoutComponents {
20                  apiName
21                  componentType
22                }
23              }
24            }
25          }
26        }
27      }
28    }
29  }
30}

Get Object Layout with Pagination 

This example gets the account layout with pagination.

Get Account Layout with Pagination
1{
2  uiapi {
3    recordLayouts(objectApiName: "Account", first: 5) {
4      edges {
5        node { id recordTypeId }
6        cursor
7      }
8      pageInfo {
9        hasNextPage
10        endCursor
11      }
12      totalCount
13    }
14  }
15}

This example gets the next page.

Get Next Page of Account Layout
1{
2  uiapi {
3    recordLayouts(objectApiName: "Account", first: 5, after: "<endCursor>") {
4      edges {
5        node { id recordTypeId }
6        cursor
7      }
8      pageInfo {
9        hasNextPage
10        endCursor
11      }
12    }
13  }
14}

Get Object Layout with Polymorphic Components 

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

Get Account Layout with Polymorphic Components
1{
2  uiapi {
3    recordLayouts(objectApiName: "Account") {
4      edges {
5        node {
6          sections {
7            layoutRows {
8              layoutItems {
9                label
10                layoutComponents {
11                  apiName
12                  componentType
13                  ... on FieldLayoutComponent {
14                    label
15                  }
16                  ... on VisualforceLayoutComponent {
17                    visualforceUrl
18                    height
19                    width
20                    showLabel
21                    showScroll
22                  }
23                  ... on CanvasLayoutComponent {
24                    referenceId
25                    displayLocation
26                    height
27                    width
28                  }
29                  ... on CustomLinkLayoutComponent {
30                    customLinkUrl
31                    label
32                    behavior
33                  }
34                  ... on ReportLayoutComponent {
35                    reportId
36                    filter
37                    size
38                    showTitle
39                    hideOnError
40                    cacheData
41                  }
42                }
43              }
44            }
45          }
46        }
47      }
48    }
49  }
50}

See Also 

Get Object Layouts