# Servicenow

![servicenow-header-logo.svg](https://assets.relyanceuat.xyz/images/docs/6183183538829/6181606358925.svg)
ServiceNow is a cloud-based software as a service (SaaS) company that provides a workflow automation platform that enables enterprise organizations to improve operational efficiencies by streamlining and automating routine work tasks. It enables enterprise organizations to improve operational efficiencies by streamlining and automating routine work tasks.

In order to integrate Servicenow with Relyance AI you will need your Servicenow **Subdomain**, **Client ID**, and **Client Secret**.

Important Prerequisite:

Some of the endpoints are specific to the **Customer Service Management** plugin which is a paid feature.

Please follow the steps as described in the link below:

[https://docs.servicenow.com/en-US/bundle/sandiego-customer-service-management/page/product/customer-service-management/task/t_ActivateCustomerService.html](https://docs.servicenow.com/en-US/bundle/sandiego-customer-service-management/page/product/customer-service-management/task/t_ActivateCustomerService.html)

This integration queries the following endpoints:

- contact
- consumer
- account
- get_user_employee_profile
- tables:
    - sys_user
    - customer_account
    - imp_user
    - sn_hr_core_profile
    - cmdb_ci_database
    - cmdb_ci_service

#### In Servicenow:

1. Login to your Servicenow account.
2. Go to the Developers service as a starting point: [https://developer.servicenow.com/](https://developer.servicenow.com/)
3. Click on the Account profile menu in the top right-hand header and select **Start Building**.
4. This will bring you into your Servicenow instance.
5. The subdomain in your web browser URL is your Servicenow **Subdomain**:
6. In the Servicenow instance page, find **System OAuth**> **Application Registry** in the left-hand navigation menu.
7. Click the **New** button.
8. Select **Create an OAuth API endpoint for external clients**.
9. In this page fill out the following options: i. Use **Relyance** for the name. ii. Enter [**https://root.relyance.ai/api/oauth2**](https://root.relyance.ai/api/oauth2) for the redirect URL. iii. Use this logo for the Oauth logo: [https://assets-global.website-files.com/60f0e9549971edb98c4e4403/60f6edd59147337ac1320add_logo_relyance.svg](https://assets-global.website-files.com/60f0e9549971edb98c4e4403/60f6edd59147337ac1320add_logo_relyance.svg)
10. Click the **Submit** button.
11. Find the new Relyance connection and click on it.
12. Copy the **Client ID** and **Client Secret** to be used in Relyance AI.

![servicenow-1.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6181977122573.png)

![Servicenow-2.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6182213808909.png)

![Servicenow-6.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6353941124365.png)

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **Servicenow** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Oauth2 / App Token**.
8. Paste the **Subdomain**, **Client ID**, and **Client Secret** into their respective fields.

![Servicenow-3.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6183146997261.png)

9. Click **Authenticate**.
10. This will bring you to Servicenow's page (login if you need to) and allow Relyance AI permission to connect to Servicenow.

![Servicenow-4.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6183157660941.png)

11. At this point, you should see the following result on the Vendor Integrations page:

![Servicenow-5.png](https://assets.relyanceuat.xyz/images/docs/6183183538829/6183191299469.png)

12. Congratulations, you are now connected to **Servicenow**.

<!-- failure-modes:begin (generated from the integration catalog; do not hand-edit) -->

## If the connection reports Connected but returns nothing

These are the ways this integration comes back empty without reporting an error. Generated from the integration catalog, so it tracks what the connection actually asks for.

1. **A feature you enabled returns nothing.** Some scopes belong to a feature rather than to the connection: **Data subject requests** needs `csm_ws_integration`, `sn_hr_core.usa_employee_only`, `sn_customerservice.customer_data_viewer`, `sn_customerservice_agent`, `snc_internal`, `sn_customerservice.unified_consumer`, `sn_customerservice.consumer`, `sn_customerservice.contact_manager`, `sn_publications.author`, `sn_customerservice.customer`, `sn_customerservice.customer_admin`, `sn_customerservice_manager`, `customer_account_admin`, `sn_hr_core.secure_info_writer`, `sn_customerservice.consumer_agent`, `admin`, `user_admin`. Turning the feature on after the connection exists does not widen the grant it already holds, so re-authenticate the connection.
2. **Authorised, then empty.** The connection carries an authorisation, not a password: it stops returning data if the account that granted it loses access, its own permissions narrow, or the grant is revoked at the vendor. None of that reports an error here -- the connection keeps its last status until the next scan.
3. **A credential rotated at the vendor is not picked up here.** **Client Secret** is stored when you save the connection, so regenerating the value at the vendor breaks the next scan until it is re-pasted here. Recording the expiry on the connection means Relyance warns you before it lapses.
4. **Check the address fields before suspecting the credentials.** **Subdomain (Eg: dev12345)** identifies which tenant, region or host to talk to. A wrong value there fails authentication and looks exactly like a bad secret.

<!-- failure-modes:end -->

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

The **OAuth (browser authorization)** method uses a browser authorization flow, so the connection is created in the Relyance app. Manage it in Terraform afterwards by importing it (`terraform import relyance_integration_connection.example servicenow/<connection_id>`) or reading it with the `relyance_integration_connection` data source.

<!-- terraform-examples:end -->
