> For the complete documentation index, see [llms.txt](https://atlas.anywhere.now/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atlas.anywhere.now/channels-integrations/crm-service/sql-server.md).

# SQL Server CRM Service

Configure CRM Service for a SQL Server data source.

Configure CRM Service for SQL Server when WebAgent must retrieve CRM-style information from a supported SQL Server data source.

Before requesting the service, confirm the [shared CRM connector licensing prerequisites](/channels-integrations/crm-service.md#licensing-prerequisites).

{% hint style="info" %}
Confirm SQL Server CRM Service supportability, hosting model, network access, and customer responsibility boundaries for the environment before starting.
{% endhint %}

## Request SQL Server CRM Service in OnePortal

1. Request the SQL Server CRM Service for the customer environment through the current OnePortal, delivery, or support process.
2. Confirm which UCC and WebAgent configuration must consume SQL Server data.
3. Confirm that SQL Server is the enabled CRM Service provider before changing provider settings.
4. Use [Configure CRM Service settings](/channels-integrations/crm-service/configure-crm-service-settings.md) for shared request, change, `PluginSettings`, `PluginAttributes`, and secret-handling rules.

## Prepare SQL Server

Prepare database access before CRM Service settings are completed.

| Preparation item     | What to prepare                                                                | Used by CRM Service                   |
| -------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
| Database endpoint    | SQL Server host, database, and network access approved for the environment.    | Connection string                     |
| Authentication model | Credential or managed access model approved for CRM Service.                   | Connection string and secret handling |
| Tables or views      | Tables, views, or query objects that expose the records WebAgent must display. | Query templates and mappings          |
| Read permissions     | Least-privilege read access to the required tables or views.                   | CRM Service data retrieval            |
| Test records         | Known contact, lead, account, or case records for validation.                  | Validation                            |

Use current SQL Server tooling as needed:

* [SQL Server Management Studio download](https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16)
* [Azure Data Studio download](https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver16\&tabs=redhat-install%2Credhat-uninstall)

## Configure SQL Server CRM Service in Dialogue Cloud Neo / SharePoint

Enter or request these values in the active configuration source for `CrmService` `PluginSettings`.

| Setting            | Requirement                          | Value                                                                                                                                                                                                                                                |
| ------------------ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ConnectionString` | Required                             | Encrypted SQL Server connection details supplied through the approved configuration or secret process for the environment. Store the connection-string value in this setting for the provider; do not publish credential-bearing connection strings. |
| `BaseContactQuery` | Required                             | Contact query template that matches the customer data model. Example pattern: `Select Top (100) {0} From Contact Where {1}`.                                                                                                                         |
| `BaseLeadsQuery`   | Required when lead retrieval is used | Lead query template that matches the customer data model. Example pattern: `Select Top (100) {0} From Contact Where {1}`.                                                                                                                            |

Configure SQL Server column mappings in `CrmService` `PluginAttributes` when default mapping is not sufficient for the customer data model.

{% hint style="warning" %}
Do not publish unmanaged database credentials. Confirm database ownership, network access, query ownership, and rollback expectations before changing SQL Server CRM Service configuration.
{% endhint %}

## Configure optional SQL Server settings in Dialogue Cloud Neo / SharePoint

Add optional settings with scope `CrmService`.

| Setting or mapping            | Where configured   | Default or value guidance                                                                                                                                                                                                  |
| ----------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ShowStatus`                  | `PluginSettings`   | Shows whether the caller is a contact, lead, or unknown. Confirm the value approved for the environment.                                                                                                                   |
| `PhoneNumberFormat`           | `PluginSettings`   | Phone-number matching mode. Use the mode approved for the SQL data.                                                                                                                                                        |
| `CaseStatus`                  | `PluginSettings`   | Maps SQL Server-backed case status text to WebAgent status. Keep the mapping aligned with the `PluginAttributes` item used as the case status.                                                                             |
| `BaseCaseQuery`               | `PluginSettings`   | Case query. Use a query that matches the customer case table or view.                                                                                                                                                      |
| `ContactCaseFilter`           | `PluginSettings`   | Optional where statement for retrieving cases. Use a predicate that matches the customer data model.                                                                                                                       |
| `UseDefaultPluginAttributes`  | `PluginSettings`   | Set an explicit value only when default SQL Server `PluginAttributes` behavior is confirmed for the environment.                                                                                                           |
| `DbType`                      | `PluginSettings`   | Selects a non-default data provider where required. If absent or empty, the default SQL Server provider is used. Use values such as `oledb` only when the customer data source and support guidance require that provider. |
| SQL Server `PluginAttributes` | `PluginAttributes` | Map SQL Server columns to WebAgent contact, lead, case, and search output.                                                                                                                                                 |

<details>

<summary>SQL Server query and mapping guidance</summary>

For SQL Server `PluginAttributes`, `SystemName` must be the SQL database column name returned by the configured query. Use:

* `DisplayName` for the label shown in WebAgent.
* `ShowOnExtensionWindow` to control whether WebAgent displays the value.
* `Order`; restart numbering for each `Category`.
* `FieldType` values such as `Id`, `Name`, `PhoneNumber`, `SipAddress`, `Email`, `Date`, and `Search`.
* `Hyperlink` to make a value clickable; include `SystemName` placeholders in square brackets when the link needs field values.
* `ShowOnToast` to force the column into the query.

SQL Server mapping guidance also notes:

* Values from multiple text columns can be combined on one WebAgent line when the `DisplayName` is the same and the `Order` values are consecutive.
* This combination method applies to text fields; do not use it for hyperlinks or URL-backed values.
* The `ContactSearch` category falls back to `Contact` if no `ContactSearch` items are supplied. The same fallback applies from lead, lead-search, case, and case-search categories to their base categories.
* At least one contact identifier and searchable phone/email/SIP mapping must exist for reliable contact matching.

No reusable exact default `PluginAttributes` rows are published for SQL Server because table names, view names, column names, query templates, and mappings are customer-data-model dependent.

Keep table-creation scripts, complete query templates, and mapping records in the delivery or configuration record. Include customer-specific SQL only when the customer must validate a table, view, join, or field mapping.

</details>

## Validate SQL Server CRM Service

1. Confirm that CRM Service can reach the SQL Server data source.
2. Search for a known contact, lead, account, or case from WebAgent.
3. Confirm that expected SQL Server-backed fields appear in WebAgent.
4. Confirm that phone-number recognition returns the expected SQL Server-backed record.

## References

* [SQL Server Management Studio download](https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16)
* [Azure Data Studio download](https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver16\&tabs=redhat-install%2Credhat-uninstall)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://atlas.anywhere.now/channels-integrations/crm-service/sql-server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
