> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runalloy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Dynamics Customer Service

> Integration details and setup guide for the Microsoft Dynamics Customer Service connector in Alloy Automation.

## Pre-Built Tooling

| Category                            | Details                                                                      |
| ----------------------------------- | ---------------------------------------------------------------------------- |
| **Authentication**                  | OAuth 2.0 (Authorization Code with refresh tokens)                           |
| **Two-Way Sync**                    | No                                                                           |
| **Events Supported**                | No                                                                           |
| **Realtime**                        | Polling                                                                      |
| **Supports Rate Limiting**          | Yes                                                                          |
| **Authentication Scopes Supported** | `openid`, `email`, `profile`, `offline_access`, and Dynamic URL-based scopes |

***

## Objects Supported

Alloy Automation supports syncing the following objects from **Microsoft Dynamics Customer Service**:

Based on the Microsoft Dynamics 365 Web API, typical objects include:

* **Accounts**
* **Contacts**
* **Cases**
* **Activities (Emails, Phone Calls, Tasks)**
* **Opportunities**
* **Leads**
* **Users**
* **Teams**

***

## Set Up Guide

### Trial Access

| Question                                           | Answer                                                                                                                                                          |
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Offers free trial?**                             | Yes. Microsoft offers a 30-day free trial of Dynamics 365 Customer Service. [Start free trial](https://dynamics.microsoft.com/en-us/customer-service/overview/) |
| **Requires paid sandbox**                          | No. Trial environments can be used for testing and development.                                                                                                 |
| **Requires partnership to obtain authentication?** | No, but you need an Azure AD tenant and must register an application in the Azure Portal.                                                                       |

***

### Authentication (OAuth 2.0)

For customers who want to completely whitelabel their OAuth experience, you can provide your own developer keys instead of using Alloy Automation's.

#### Create your OAuth app (Azure Portal)

1. Go to **Azure Portal** ([https://portal.azure.com/](https://portal.azure.com/)) and sign in with your Microsoft account.
2. Navigate to **Azure Active Directory** → **App registrations** → **New registration**.
3. Fill in your application details:
   * **Name**: Your application's name
   * **Supported account types**: Choose the appropriate option (typically "Accounts in any organizational directory")
   * **Redirect URI**: Select "Web" and enter `https://api.runalloy.com/api/strategy/connector/microsoftCRM/callback`
4. Click **Register** to create the application.
5. Note your **Application (client) ID** from the Overview page.
6. Navigate to **Certificates & secrets** and click **New client secret**.
7. Add a description and expiration period, then click **Add**.
8. Copy the **Value** of the client secret immediately (it won't be shown again).
9. Navigate to **API permissions** and click **Add a permission**.
10. Select **Dynamics CRM** and add the following delegated permissions:
    * `user_impersonation` - Access Dynamics 365 as organization users
11. You may also need to add Microsoft Graph permissions:
    * `openid`, `email`, `profile`, `offline_access`
12. Click **Grant admin consent** if you have admin privileges, or ask your tenant administrator to grant consent.
13. Copy your **Application (client) ID** and **Client Secret** into Alloy Automation.

#### Important Notes

* The organization subdomain (e.g., `yourorg.crm.dynamics.com`) must be configured correctly to access the specific Dynamics 365 instance.
* Users must have appropriate security roles in Dynamics 365 to access entities via the API.
* OAuth tokens respect the user's permissions - API calls will fail if the authenticated user lacks access to specific records or entities.

***

## Use Cases

### 1) Unified customer service ticketing

Sync customer support cases from Dynamics 365 Customer Service into your multi-channel support platform, enabling agents to manage tickets from email, chat, and phone in a single interface.

### 2) Sales and service alignment

Connect Dynamics 365 Customer Service with your CRM to provide sales teams with visibility into customer support history, enabling better account management and proactive issue resolution.

### 3) Account enrichment automation

Automatically enrich account and contact records in Dynamics 365 with data from external sources like data providers, social media, or marketing platforms to maintain complete customer profiles.

### 4) Automated case routing and escalation

Build workflows that automatically route cases to appropriate teams based on customer attributes, case properties, or SLA thresholds, and escalate high-priority issues to managers.

### 5) Service performance analytics

Extract case metrics, resolution times, and customer satisfaction data from Dynamics 365 into your business intelligence platform to create comprehensive service performance dashboards.

***

## API Gotchas

* Dynamics 365 uses OData v4 with some Microsoft-specific extensions. Complex queries require understanding of OData syntax, including `$filter`, `$expand`, and `$select`. Malformed queries will return cryptic error messages.

* The API endpoint includes an organization-specific subdomain (e.g., `orgname.crm.dynamics.com`). This subdomain must match the Dynamics 365 environment you're connecting to. Using the wrong subdomain results in authentication errors even with valid tokens.

* Field names in Dynamics 365 often have unintuitive naming conventions (e.g., `_ownerid_value` for the owner lookup field). You must use the Web API metadata endpoint to discover the exact field names and types for custom entities.

* Rate limits are enforced per user per organization instance, with limits around 60,000 API calls per 5 minutes per user. Exceeding this triggers 429 errors with mandatory retry-after periods. Service Principal authentication has different, often higher, limits.

> For questions or troubleshooting, contact **[support@runalloy.com](mailto:support@runalloy.com)**.
