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

# Microsoft Dynamics 365 Integration for Invoca AI Agents

> Connect Microsoft Dynamics 365 to Invoca AI agents so they can find, create, and update lead and contact records in Dataverse during a conversation.

The Microsoft Dynamics 365 integration lets your Invoca AI agents keep lead and contact records up to date in Dynamics during a conversation. The agent finds the caller's existing lead or contact, creates a new one when there's no match, and updates details the caller gives.

It works with Dynamics 365 apps built on Microsoft Dataverse, such as Dynamics 365 Sales. It works with both voice and SMS agents.

| Capability | What the agent can do | Changes Dynamics data? |
| - | - | - |
| Find a lead or contact | Search by phone number or name | No |
| Create a lead or contact | Add a new record when the search finds no match | Yes |
| Update a lead or contact | Change name, phone, email, company, or description on an existing record | Yes |

Setup takes four steps: register an app in Microsoft Entra ID, give it access to your Dynamics environment, connect it in Invoca, and attach the skill to your agent.

## Before you begin

* **Microsoft Dynamics is enabled on your Invoca account.** If you don't see it in Manage Integrations, contact Invoca.
* **You use a Dataverse-based Dynamics 365 app,** such as Dynamics 365 Sales. Dynamics 365 Business Central isn't supported.
* **A Microsoft Entra ID admin is available** to register an app and create a client secret.
* **A Dynamics 365 admin is available** to add that app as an application user in your environment and give it a security role.
* **You have two values ready:** your Entra tenant ID, and your Dynamics organization name (the `yourorg` part of `yourorg.crm.dynamics.com`).

## Connect Microsoft Dynamics

You connect with an app registration that you own in Microsoft Entra ID. The agent works as that app, not as a signed-in person, so you control its access through the security role you give it.

**In Microsoft Entra ID (admin):**

1. Go to **App registrations** and create a new registration. Copy its **Application (client) ID** and your **Directory (tenant) ID**.
2. Under **Certificates & secrets**, create a client secret and copy its value. Note when it expires.

**In the Power Platform admin center (Dynamics admin):**

1. Open your environment and go to **Settings > Users + permissions > Application users**.
2. Add a new app user for the app you registered.
3. Give it a security role that can read, create, and update Leads and Contacts. A custom role with only these rights is safest.

**In Invoca:**

1. Open **Manage Integrations** and select **Microsoft Dynamics**.
2. Add a new credential with your client ID, client secret, tenant ID, and organization name.
3. Save, and confirm the connection shows as connected.

If the app user is missing or its role is too narrow, the agent's requests fail with an access error.

## Fields the agent can write

The agent works with a fixed set of standard Lead and Contact fields. It can't write custom columns or any other fields.

| Field | Lead | Contact |
| - | - | - |
| First name, last name | Yes | Yes |
| Business phone, mobile phone | Yes | Yes |
| Email | Yes | Yes |
| Company name | Yes | No |
| Topic | Yes, on create (defaults to "New lead") | No |
| Description | Yes | Yes |

Last name is required to create a record. If your environment has required fields or business rules beyond these, saves may fail, so check them with your Dynamics admin before you go live.

## Add the skill to your AI agent

1. Open your agent in **Agent Builder**.
2. Open the action where the agent should save caller details. CRM skills work on any action except Schedule Appointment.
3. In the skill field, choose the Microsoft Dynamics skill, then choose your Dynamics connection.
4. Test the agent with a test record, then publish it.

## How the agent works with Microsoft Dynamics

The agent always searches Dynamics before it creates a record, and Invoca blocks any create that wasn't preceded by a search. It saves details without asking the caller to approve each change, and only says something was saved after Dynamics confirms it.

| Step | What happens |
| - | - |
| Search | Looks for leads, contacts, or both by phone number. If phone finds nothing, it tries a partial match on name. Each result is rated as exact, probable, ambiguous, or no match. |
| Unclear match | If the result is ambiguous, the agent asks the caller a question to narrow it down rather than guessing. |
| Update | When a record is found, updates only the fields the caller gave. If the record no longer exists, nothing is created in its place. |
| Create | When nothing is found, creates a lead or contact. Your Dynamics duplicate detection rules still apply as a second check. |

The agent doesn't delete records, and can't change your environment's settings or schema.

## Data and privacy

* **Your security role sets the limits.** The agent can only do what the app user's security role allows. Keep that role limited to Leads and Contacts.
* **No reading back stored data.** The agent only confirms details the caller gave, and never shares other people's records.
* **No made-up results.** The agent only says a record was saved after Dynamics confirms it.
* **No internal details.** The agent doesn't say record IDs or system terms to the caller.
* **Every write is logged** by Invoca for auditing.
* **You stay in control.** To stop access, remove the connection in Manage Integrations, delete the client secret, or remove the app user from your environment. Replace the client secret in Invoca before it expires.

## Limitations

* **Leads and contacts only.** The agent doesn't work with accounts, opportunities, activities, notes, or call transcripts.
* **No email search.** The agent finds records by phone or name, not email.
* **Phone must match exactly.** Phone search matches the number as it's stored in Dynamics, so differently formatted numbers may not match. Store phone numbers in one consistent format.
* **Fixed fields.** Custom columns can't be written.
* **No deletes.** The agent never deletes records.

## Troubleshooting

| What you see | Likely cause | What to do |
| - | - | - |
| Microsoft Dynamics isn't listed in Manage Integrations | It isn't turned on for your Invoca account | Contact Invoca to turn it on |
| The connection fails to authenticate | Wrong tenant ID, client ID, or secret, or the secret expired | Check the values in Entra ID, and create a new secret if needed |
| Access denied errors | The app isn't an application user in the environment, or its role is too narrow | Add the app user and give it read, create, and update rights on Leads and Contacts |
| The agent can't find a caller who exists | The phone number is stored in a different format | Search uses an exact match, so standardize phone formats |
| A new record isn't created | Dynamics duplicate detection blocked it, or a required field is missing | Check your duplicate detection rules and required fields |
| The wrong environment is connected | The organization name points at another environment | Check the organization name on your credential |

Still stuck? Contact Invoca with the agent name and the time of the conversation.


## Related topics

- [Microsoft Outlook Integration for Invoca AI Agents](https://docs.invoca.com/s/article/microsoft-outlook-agent-integration.md)
- [HubSpot Integration for Invoca AI Agents](https://docs.invoca.com/s/article/hubspot-agent-integration.md)
- [Zoom Integration for Invoca AI Agents](https://docs.invoca.com/s/article/zoom-agent-integration.md)
- [Salesforce Integration for Invoca AI Agents](https://docs.invoca.com/s/article/salesforce-agent-integration.md)
- [Calendly Integration for Invoca AI Agents](https://docs.invoca.com/s/article/calendly-agent-integration.md)
