# ServiceNow

> Source: https://truto.one/docs/integration-guides/servicenow/

ServiceNow connects with the OAuth 2.0 client credentials grant: an OAuth application in your instance, tied to a ServiceNow user whose roles decide what Truto can read and write.

:::callout{type="info"}
- You need the `admin` role on the ServiceNow instance.
:::

## Install the ServiceNow integration

Install ServiceNow from [Available integrations](https://app.truto.one/integrations/available/8fc057bb-dc1b-4e11-a508-747a0e374d6b) in each environment you connect accounts from.

## 1. Enable the client credentials grant

ServiceNow turns the client credentials grant off by default. Create the system property that turns it on:

- **Name**: `glide.oauth.inbound.client.credential.grant_type.enabled`
- **Value**: `true`

See ServiceNow's [Client Credentials](https://www.servicenow.com/docs/r/xanadu/platform-security/authentication/client-credentials.html) docs.

## 2. Register an OAuth endpoint

1. Go to **All** → **System OAuth** → **Application Registry** and click **New**.
2. Select **Create an OAuth API endpoint for external clients**.
3. Enter a name. ServiceNow generates a **Client ID** and a **Client Secret**.
4. Add the **OAuth Application User** field to the form, and set it to the ServiceNow user Truto acts as. Give that user the roles for the tables you need.
5. Save the record, then copy the **Client ID** and **Client Secret**.

## Connect a ServiceNow account

1. In [Integrated Accounts](https://app.truto.one/integrated-accounts), click **Connect Account**.
   ![Click Connect Account](https://docs-assets.truto.one/truto-connect-account.png)
2. Enter a **Tenant ID** (your customer's ID; Truto creates the tenant if it is new), or pick one under **Existing tenant (optional)**. Check the **Environment** and the **Region** (where Truto places the account; Western North America by default). To open the link straight on ServiceNow, pick it under **Advanced settings** → **Integration (optional)**. Click **Get connection link**.
   ![Get connection link](https://docs-assets.truto.one/truto-connect-account-modal.png)
3. Click the open-in-new-tab button, or click **Copy** and send the link to your customer so they connect their own ServiceNow account. The link works for 7 days, until an account is connected with it.
   ![Share connection link](https://docs-assets.truto.one/truto-connect-account-link.png)
4. Click **Get Started** if it shows, then select **ServiceNow**.
5. Fill in the form and click **Connect**:

   | Field | Required | What to enter |
   |---|---|---|
   | **Client ID** | Yes | The **Client ID** of the OAuth application. |
   | **Client Secret** | Yes | The **Client Secret** of the OAuth application. |
   | **Instance Name** | Yes | The first part of your instance URL: for `https://acme.service-now.com`, enter `acme`. |
   | **Service Module** | Yes | Which ServiceNow product the account uses. Pick **CSM** for Customer Service Management, or leave **ITSM** for IT Service Management. |
6. Close the tab when you see **Connection successful**. The new account appears under **Integrated Accounts**. Click its Account ID to see its details and make API calls.
