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.
1{
2 uiapi {
3 recordLayouts(objectApiName: ["Account"]) {
4 # fields
5 }
6 }
7}Record Layout Schema
Query recordLayouts by using this schema.
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 oflayoutConfigtypes 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 isLARGE.mode- Mode that the LayoutMode enum provides for the record type layout. Default value isVIEW.
-
layoutType- Layout type that the LayoutType enum provides. Default value isFULL. -
formFactor- Default form factor that the FormFactor enum provides for all layouts. Default value isLARGE. -
mode- Default mode that the LayoutMode enum provides for all layouts. Default value isVIEW. -
first- Number of layouts per page. Specify up to 10 layouts. Default value is10. -
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.
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.
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.
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.
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.
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.
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.
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 isnull. 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.
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.
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 isCANVAS.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.
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 isCUSTOM_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.
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 isEMPTY_SPACE.
FieldLayoutComponent
The FieldLayoutComponent is a standard field on a record layout.
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 isFIELD.label- Label of the field.
ReportLayoutComponent
The ReportLayoutComponent is an embedded report chart component on a record layout.
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 isREPORT_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.
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 isVISUALFORCE_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.
1enum FormFactor {
2 LARGE
3 MEDIUM
4 SMALL
5}LayoutComponentType
The LayoutComponementType enumeration indicates the layout component type.
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.
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.
1enum LayoutType {
2 FULL
3 COMPACT
4}TabOrder
The TabOrder enumeration specifies the tab order for the items in a section.
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.
1enum UiBehavior {
2 EDIT
3 REQUIRED
4 READONLY
5}WeblinkWindowType
The WeblinkWindowType enumeration indicates how a link behaves on open.
1enum WeblinkWindowType {
2 NEW_WINDOW
3 NO_SIDEBAR
4 ONCLICK_JAVASCRIPT
5 REPLACE
6 SIDEBAR
7}