# Microsoft Dynamics 365

> Microsoft Dynamics 365 is a CRM and ERP platform that provides sales, customer service, field service, and marketing automation solutions for your business.

Microsoft Dynamics 365 tracks your sales pipeline and customer interactions, but understanding which marketing channels drive your highest-value opportunities or how support cases affect renewal rates requires connecting to your ad platforms, analytics tools, and product data.

Filament links your Dynamics 365 accounts, contacts, and opportunities to your marketing and support tools so you can build a kpi dashboard tracking pipeline velocity, campaign attribution, and customer lifecycle metrics without manual exports.

## Data we sync

- **Accounts**: Track customer organizations with name, industry, annual revenue, account status, owner, and relationship type to analyze account health and segment your customer base. (`accountid`, `name`, `revenue`, `industrycode`, `statecode`, `ownerid`)
- **Contacts**: Track individual customer contacts with email, phone, job title, account relationship, lead source, and engagement score to analyze contact quality and communication patterns. (`contactid`, `emailaddress1`, `jobtitle`, `parentcustomerid`, `leadsourcecode`, `address1_composite`)
- **Opportunities**: Track sales pipeline with estimated revenue, close date, sales stage, probability, actual revenue, and campaign source to measure pipeline velocity and forecast accuracy. (`opportunityid`, `estimatedvalue`, `estimatedclosedate`, `salesstage`, `closeprobability`, `actualvalue`, `campaignid`)
- **Leads**: Track potential customers with lead source, qualification status, estimated revenue, industry, rating, and creation date to measure lead quality and conversion rates across channels. (`leadid`, `leadsourcecode`, `statuscode`, `estimatedamount`, `industrycode`, `leadqualitycode`, `createdon`)
- **Activities**: Track customer interactions including emails, phone calls, appointments, and tasks with subject, status, duration, regarding object, and completion date to analyze engagement patterns. (`activityid`, `activitytypecode`, `subject`, `statecode`, `actualdurationminutes`, `regardingobjectid`, `actualend`)
- **Campaigns**: Track marketing campaigns with budget, actual cost, campaign type, expected revenue, total leads, and total campaign activities to measure marketing roi and campaign effectiveness. (`campaignid`, `budgetedcost`, `actualcost`, `typecode`, `expectedrevenue`, `totalactualrevenue`, `totalcampaignactivityactualcost`)
- **Cases**: Track customer service requests with case type, priority, status, resolution time, customer satisfaction, and related account to analyze support quality and identify common issues. (`incidentid`, `casetypecode`, `prioritycode`, `statecode`, `resolveby`, `customersatisfactioncode`, `customerid`)
- **Quotes**: Track sales quotes with total amount, discount, quote status, expiration date, and related opportunity to analyze quote conversion rates and pricing effectiveness. (`quoteid`, `totalamount`, `discountamount`, `statecode`, `effectiveto`, `opportunityid`, `pricelevelid`)
- **Orders**: Track customer orders with total amount, order status, fulfillment date, payment terms, and related account to analyze order patterns and revenue realization. (`salesorderid`, `totalamount`, `statecode`, `datefulfilled`, `paymenttermscode`, `customerid`, `opportunityid`)

## How do I connect Microsoft Dynamics 365?

You need a Dynamics 365 CRM account and a Microsoft Entra ID tenant. The connecting user needs read access to the data you want; entities using Change Tracking require organisation-wide read access.

### Find your connection details

1. In Azure, use your account menu’s **Switch directory** to select the correct tenant.
2. Open **Microsoft Entra ID → Overview** and copy the primary domain.
3. In Dynamics CRM, open **Settings → Advanced Settings → Customizations → Developer Resources** and copy the **Service Root URL**.
4. Open [Apps](https://filamentanalytics.com/apps) in Filament and add **Microsoft Dynamics 365**. Enter the domain and Service Root URL.

### Authorise with your Microsoft account

Choose **OAuth2**, select **Authorize** and sign in to the account with CRM access. Approve access, select **Save & Test**, then return to Filament and complete setup.

### Alternatively, use a service principal

1. In Entra ID, open **App registrations → New registration**. Name the app, choose accounts in this organisational directory only, and register it. Copy the **Application (client) ID**.
2. Under **API permissions → Add a permission → Dynamics CRM**, add `user_impersonation`.
3. Open **Certificates & secrets → New client secret**. Choose an expiry and copy the secret’s **Value**, not its ID. Update the connection before that secret expires.
4. In the Power Platform admin centre, select **Environments → your environment → Settings → Users + permissions → Application users → New app user**.
5. Select **Add an app**, find the registered app by its client ID, and choose its business unit. Assign **Service Reader**, or a custom role with the required read access, then create the user.
6. In Filament’s connection form, choose **Service Principal** and enter the application ID and secret alongside the domain and resource URL.
7. Select **Save & Test**, then return to Filament and complete setup.

Calculated, formula and rollup fields may need a table resync to reflect changes; Change Tracking does not capture every recalculation.
