> 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/dynamics-365.md).

# Dynamics 365 CRM Service

Configure CRM Service for Dynamics 365.

Configure CRM Service for Dynamics 365 when WebAgent must retrieve Dynamics 365 or Dataverse information.

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

## Request Dynamics 365 CRM Service in OnePortal

1. Request the Dynamics 365 CRM Service for the customer environment through the current OnePortal, delivery, or support process.
2. Confirm which UCC and WebAgent configuration must consume Dynamics 365 data.
3. Confirm that Dynamics 365 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.

{% hint style="info" %}
Exact OnePortal labels can differ by release. Use the current customer-specific request path instead of legacy labels.
{% endhint %}

## Prepare Dynamics 365

Prepare Microsoft Entra ID application access and Dynamics 365 data access before entering CRM Service settings.

| Preparation item                    | What to prepare                                                                                                                                                                                 | Used by CRM Service                               |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| Dynamics 365 environment URL        | Customer-specific Dynamics 365 or Dataverse environment URL.                                                                                                                                    | `ConnectionString` and optional `ApplicationHost` |
| Microsoft Entra ID app registration | App registration approved for CRM Service, including client ID and client secret.                                                                                                               | `ConnectionString`                                |
| Client-secret authentication        | Connection-string values for client-secret authentication, including `AuthenticationType=ClientSecret`, `SkipDiscovery=true`, and `RequireNewInstance=true` where required for the environment. | Dynamics 365 authentication                       |
| Application user                    | Dynamics 365 application user or equivalent access model tied to the app registration.                                                                                                          | Data access for CRM Service                       |
| Security role or permissions        | Access to the entities and records WebAgent must display.                                                                                                                                       | Query and field retrieval                         |

Use current Microsoft administration guidance and verify current UI labels before changing authentication:

* [Microsoft Azure portal](https://portal.azure.com/)
* [Use single-tenant server-to-server authentication](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-single-tenant-server-server-authentication)
* [Power Platform admin center](https://admin.powerplatform.microsoft.com/)
* [Create an application user](https://learn.microsoft.com/en-us/power-platform/admin/manage-application-users#create-an-application-user)
* [Use connection strings with XRM tooling](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/xrm-tooling/use-connection-strings-xrm-tooling-connect)

## Configure Dynamics 365 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    | Dynamics 365 URL, client ID, encrypted client secret, `AuthenticationType=ClientSecret`, `SkipDiscovery=true`, `RequireNewInstance=true`, and related connection options approved for the environment. |
| `ApplicationHost`  | Optional    | Dynamics 365 application root URL when required by the environment, for example `https://<tenant>.crm4.dynamics.com/`.                                                                                 |

Configure Dynamics 365 field mappings in `CrmService` `PluginAttributes` when the default mapping is not sufficient for the customer data model.

{% hint style="warning" %}
Do not publish or store an unmanaged client secret. Use the approved secret-handling process for the environment.
{% endhint %}

## Configure optional Dynamics 365 settings in Dialogue Cloud Neo / SharePoint

Add optional settings with scope `CrmService`.

| Setting                         | Where configured   | Default or value guidance                                                                                                                                                                                                                                                                             |
| ------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ShowStatus`                    | `PluginSettings`   | Shows whether the caller is a contact, lead, or unknown. Default: `True`.                                                                                                                                                                                                                             |
| `DefaultPhoneNumberRegion`      | `PluginSettings`   | ISO 3166 alpha-2 region code. Default: `ZZ`.                                                                                                                                                                                                                                                          |
| `PhoneNumberFormat`             | `PluginSettings`   | Default: `Wildcard`. Supported modes include `E164`, `International`, `Rfc3966`, and `Wildcard`. Use a more exact supported format when Dynamics 365 phone fields store numbers consistently.                                                                                                         |
| `CaseStatus`                    | `PluginSettings`   | Maps Dynamics 365 case status text to WebAgent status. Default mappings: `New=Open`, `In Progress=Open`, `On Hold=Open`, `Resolved=Closed`, `Closed=Closed`, `Canceled=Closed`. Keep this aligned with the case status `SystemName`; the default `PluginAttributes` table maps Status to `statecode`. |
| `SupportedFileExtensions`       | `PluginSettings`   | Restricts attachment file extensions. Default allows all file types (`*`). To restrict, use a semicolon-separated list such as `.txt;.png`.                                                                                                                                                           |
| `MaxFileSizeInKB`               | `PluginSettings`   | Restricts attachment size in KB. Example: for about 2 MB, use `2000`.                                                                                                                                                                                                                                 |
| `BaseContactQuery`              | `PluginSettings`   | FetchXML query for contacts. Default uses `fetch distinct='true' top='100'`, entity `contact`, and an outer `account` link with aliases. `top` is mandatory and linked entities must have aliases.                                                                                                    |
| `BaseLeadQuery`                 | `PluginSettings`   | FetchXML query for leads. Default uses `fetch distinct='true' top='100'`, entity `lead`, an outer owner link, and excludes inactive leads with `statecode ne 1`. `top` is mandatory and linked entities must have aliases.                                                                            |
| `BaseCaseQuery`                 | `PluginSettings`   | FetchXML query for cases. Default uses `fetch distinct='true' top='50'`, entity `incident`, and orders by `modifiedon` descending.                                                                                                                                                                    |
| `ContactCaseFilter`             | `PluginSettings`   | FetchXML filter used when retrieving cases for a contact. Default matches `contactid` or `accountid` against contact/account placeholders. Condition attributes and values must be valid `SystemName` values.                                                                                         |
| `UseDefaultPluginAttributes`    | `PluginSettings`   | Default behavior: if the setting is absent or `True`, CRM Service uses default Dynamics 365 `PluginAttributes`. Set to `False` only when all required Dynamics 365 `PluginAttributes` will be maintained manually.                                                                                    |
| Dynamics 365 `PluginAttributes` | `PluginAttributes` | Map Dynamics 365 attributes to WebAgent contact, lead, contact-search, lead-search, case, and case-search output.                                                                                                                                                                                     |

<details>

<summary>Dynamics 365 query and mapping guidance</summary>

For Dynamics 365 `PluginAttributes`, use Dynamics 365 attributes as `SystemName` values. If an attribute comes from a linked entity, include the alias before the attribute. 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.
* `Scope` set to `CrmService` where the configuration source requires it.
* `ShowOnToast` to force the attribute into the query.

When adding attributes from another entity, also update the relevant base FetchXML query so the field is returned.

### Default `PluginAttributes`

The default Dynamics 365 rows are used when `UseDefaultPluginAttributes` is absent or `True`. Preserve linked-entity aliases in `SystemName` values. The `{uri.Scheme}` and `{uri.Host}` placeholders are valid for predefined values; use complete URLs when overriding hyperlinks.

| DisplayName          | SystemName               | Category | Order | ShowOnExtensionWindow | FieldTypes             | Hyperlink                                                                | ShowOnToast |
| -------------------- | ------------------------ | -------- | ----: | --------------------- | ---------------------- | ------------------------------------------------------------------------ | ----------- |
| Company              | `companyname`            | Account  |     0 | No                    | `Name`                 |                                                                          | Yes         |
| Account ID           | `accountid`              | Account  |     1 | No                    | `Id`                   |                                                                          | No          |
| Company              | `name`                   | Account  |     2 | Yes                   | `Name, Search`         |                                                                          | No          |
| Phone Number         | `telephone1`             | Account  |     3 | Yes                   | `phone number, Search` |                                                                          | No          |
| Owner                | `owner.fullname`         | Account  |     4 | Yes                   |                        |                                                                          | No          |
| Case ID              | `incidentid`             | Case     |     1 | No                    | `Id`                   | `{uri.Scheme}://{uri.Host}/m/ef.aspx?etn=incident&id=%7b[incidentid]%7d` | No          |
| Title                | `title`                  | Case     |     2 | Yes                   | `Name, Search`         |                                                                          | No          |
| Description          | `description`            | Case     |     3 | Yes                   |                        |                                                                          | No          |
| Date                 | `modifiedon`             | Case     |     4 | Yes                   | `Date`                 |                                                                          | No          |
| Status               | `statecode`              | Case     |     5 | Yes                   | `FormattedValue`       |                                                                          | No          |
| Contact ID           | `contactid`              | Contact  |     1 | No                    | `Id`                   | `{uri.Scheme}://{uri.Host}/m/ef.aspx?etn=contact&id=%7b[contactid]%7d`   | No          |
| Account ID           | `account.accountid`      | Contact  |     2 | No                    | `Id`                   |                                                                          | No          |
| Name                 | `fullname`               | Contact  |     3 | No                    | `Name`                 |                                                                          | Yes         |
| Email                | `emailaddress1`          | Contact  |    10 | Yes                   | `Search, Email`        |                                                                          | No          |
| Phone Number         | `telephone1`             | Contact  |    20 | Yes                   | `Search, phone number` |                                                                          | No          |
| Phone Number 2       | `telephone2`             | Contact  |    21 | Yes                   | `Search, phone number` |                                                                          | No          |
| Mobile Number        | `mobilephone`            | Contact  |    22 | Yes                   | `Search, phone number` |                                                                          | No          |
| Company              | `account.name`           | Contact  |    30 | Yes                   | `Name`                 |                                                                          | Yes         |
| Owner                | `account.owner.fullname` | Contact  |    40 | Yes                   |                        |                                                                          | Yes         |
| Company Phone Number | `account.telephone1`     | Contact  |    45 | No                    | `phone number`         |                                                                          | No          |
| Lead ID              | `leadid`                 | Lead     |     1 | No                    | `Id`                   | `{uri.Scheme}://{uri.Host}/m/ef.aspx?etn=lead&id=%7b[leadid]%7d`         | No          |
| Name                 | `fullname`               | Lead     |     3 | No                    | `Name`                 |                                                                          | Yes         |
| Email                | `emailaddress1`          | Lead     |    10 | Yes                   | `Search, Email`        |                                                                          | No          |
| Phone Number         | `telephone1`             | Lead     |    20 | Yes                   | `Search, phone number` |                                                                          | No          |
| Phone Number 2       | `telephone2`             | Lead     |    21 | Yes                   | `Search, phone number` |                                                                          | No          |
| Mobile Number        | `mobilephone`            | Lead     |    22 | Yes                   | `Search, phone number` |                                                                          | No          |
| Company              | `companyname`            | Lead     |    30 | Yes                   | `Name`                 |                                                                          | Yes         |
| Owner                | `account.name`           | Lead     |    40 | Yes                   |                        |                                                                          | Yes         |

LeadSearch is a copy of Lead, with `Name` also receiving the `Search` field type.

</details>

## Validate Dynamics 365 CRM Service

1. Confirm that CRM Service can reach the Dynamics 365 endpoint.
2. Search for a known Dynamics 365 contact, lead, or case from WebAgent.
3. Confirm that expected Dynamics 365 fields appear in WebAgent.
4. Confirm that phone-number recognition returns the expected Dynamics 365 record.

## References

* [Microsoft Azure portal](https://portal.azure.com/)
* [Use single-tenant server-to-server authentication](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-single-tenant-server-server-authentication)
* [Power Platform admin center](https://admin.powerplatform.microsoft.com/)
* [Create an application user](https://learn.microsoft.com/en-us/power-platform/admin/manage-application-users#create-an-application-user)
* [Use connection strings with XRM tooling](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/xrm-tooling/use-connection-strings-xrm-tooling-connect)


---

# 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/dynamics-365.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.
