---
schema_version: "1"
id: 911d12e0d29400a2ac11d366044091b166f97d9269b6f7794e8c74632e006f86
title: GraphQL API
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/release-notes/260-0-0/rn_api_graphql.md
canonical_url: https://help.salesforce.com/s/articleView?id=release-notes.rn_api_graphql.htm&release=260&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 739169a197e2677a815161b1744d0a11690f5e9bbd6bdc6576550b648e11d0ff
description: See what’s new with GraphQL API.
products:
  - Cross Cloud Packages Solutions
release: "260"
---
# GraphQL API

See what’s new with GraphQL API.

Get the current user’s User record

Get the currently logged-in user’s User record data, such as the user’s ID or name. You can request any fields that are available on the User record.

This example queries the ID and name of the current user.

```
{
  uiapi {
    currentUser{
      Id
      Name {
        value
      }
    }
  }
}
```

This sample response includes the requested ID and name of the current user.

```
{
  "data": {
    "uiapi": {
      "currentUser": {
        "Id": "005xx000001X7sHAAS",
        "Name": {
          "value": "User‘s Name"
        }
      }
    }
  },
  "errors": [],
  "extensions": {}
}
```

Get page layout metadata for objects

Get object layouts, including sections, rows, items, and polymorphic components. Pass `recordLayouts` in the `uiapi` field and get the `LayoutConnection` type with record layout results.

This schema is for `recordLayouts`.

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

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

This example gets the layout for the account object.

```
{
  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
    }
  }
}
```

This example is the abbreviated response.

```
{
  "data": {
    "uiapi": {
      "recordLayouts": {
        "edges": [
          {
            "node": {
              "id": "00hLT000001awTWYAY",
              "layoutType": "FULL",
              "mode": "VIEW",
              "objectApiName": "Account",
              "recordTypeId": "012LT000000aFiEYAU",
              "sections": [
                {
                  "heading": "Account Information",
                  "columns": 2,
                  "rows": 18,
                  "collapsible": false,
                  "layoutRows": [
                    {
                      "layoutItems": [
                        {
                          "label": "Account Owner",
                          "required": false,
                          "editableForNew": false,
                          "editableForUpdate": false,
                          "uiBehavior": "EDIT",
                          "layoutComponents": [
                            {
                              "apiName": "OwnerId",
                              "componentType": "FIELD"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": false,
          "endCursor": "djE6NQ=="
        },
        "totalCount": 6
      }
    }
  },
  "errors": [],
  "extensions": {}
}
```

Create, update, or delete record data with mutations (generally available)

GraphQL mutations, which is now generally available, includes some changes since the beta release.

- The `RecordUpdatePayload` type includes a `Record` field that defines the fields that you want the response to return. For example, use this mutation query to update a contact record and specify the ID and name fields that you want the response to return.
    
    ```
    mutation ContactUpdateExample{
      uiapi {
        ContactUpdate(input: {
          Contact: {
            FirstName: "Sam"
            LastName: "Smith"
          }
          Id: "003RM000008AAAAAA4"
        }) {
          Record {
            Id
            FirstName {
                value
            }
            LastName {
                value
            }
          }
        }
      }
    }
    ```
    
    This example is the response.
    
    ```
    {
      "data": {
        "uiapi": {
          "ContactUpdate": {
            "Record": {
              "Id": "003RM000008AAAAAA4",
              "FirstName": {
                "value": "Sam"
              },
              "LastName": {
                "value": "Smith"
              }
            }
          }
        }
      },
      "errors": []
    }
    ```
    
    Previously, the `RecordUpdatePayload` included a `success` field that returned `true` or `false`.
- Mutations are available via the GraphQL wire adapter. Use the new `executeMutation` method from the `lightning/graphql` module. See [New and Changed Modules for Lightning Web Components](https://help.salesforce.com/s/articleView?id=release-notes.rn_lwc_modules.htm&release=260&type=5 "These modules have changes.") for more information.

Update the last viewed date on records that you query

Query objects with the new `updateMRU` argument set to `true`, which also updates the `LastViewedDate` field on the records that the query returns.

This example queries accounts with their IDs and names. The query also updates the `LastViewedDate` fields on the account records.

```
query accounts {
  uiapi {
    query {
      Account (updateMRU:true){
        edges {
          node {
            Id
            Name {
              value
            }
          }
        }
      }
    }
  }
}
```

This example is the response.

```
{
  "data": {
    "uiapi": {
      "query": {
        "Account": {
          "edges": [
            {
              "node": {
                "Id": "0015f000007wCAWAA2",
                "Name": {
                  "value": "Enfield Tennis Academy"
                }
              }
            },
            {
              "node": {
                "Id": "0015f000007vRRVAA2",
                "Name": {
                  "value": "Ennet House"
                }
              }
            }
          ]
        }
      }
    }
  }
}
```

Improved Documentation

We made these improvements to the [Reference section](https://developer.salesforce.com/docs/platform/graphql/references/graphql?meta=Summary) of the GraphQL API developer guide.

- Reference content shows only the latest API version, so you don’t need to select the API version of the reference from a dropdown menu.
    
    GraphQL reference information changes infrequently. If needed, you can find reference changes organized by API version in the [GraphQL API Reference Change Log](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-release-notes.html).
- Reference information now follows the OpenAPI Specification (OAS) standard for REST APIs.
    
    You can download the OAS from the new user interface.
- The user interface for reference content provides more streamlined navigation and clearer data structures by using a three-panel layout for navigation, details, and examples.

![GraphQL reference documentation](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-salesforce_release_notes-260-0-0-production-enus/ba62a63b-6cd1-440e-8d24-e867afab0363/salesforce_release_notes/images/rn_260_graphql_ui.png)

#### See Also

- [_GraphQL API Developer Guide_](https://developer.salesforce.com/docs/platform/graphql/guide/)