Table of Contents

Dynamics 365 connector

Create a record in a Dynamics 365 (Dataverse) table for each drop.

Important

Example to adapt. In this version, the connector sends no manifest data: the record only contains a description, with the date and the request identifier. Use it as a starting point, preferably by moving its logic into a handler.

Identifier dynamics
Address https://<server>/api/webhook/dynamics

Settings

Connector:dynamics section of appsettings.json:

Key Default Effect
ResourceUrl empty Address of your environment, for example https://<organization>.crm3.dynamics.com.
EntityName contacts Name of the entity set in which to create the record.
ApiVersion v9.2 Dataverse Web API version.

Secrets

Under Connectors.dynamics.Secrets: TenantId, ClientId and ClientSecret, from a Microsoft Entra ID app registration. In Dataverse, create an application user for this registration, with a security role that only allows creating in the target table.

If any of the three secrets is missing, every processing fails.

What it does

  1. It obtains a token for {ResourceUrl}/.default, through the client credentials flow.
  2. It sends POST {ResourceUrl}/api/data/{ApiVersion}/{EntityName}, with the OData-MaxVersion: 4.0 and OData-Version: 4.0 headers.
  3. The record only contains description: Synchronized from SESAR at <date>, followed by the request identifier.
  4. On success, the record's identifier, taken from the OData-EntityId header, is returned in ExternalReferenceId.

Test

POST /api/connectors/dynamics/test obtains a token, then calls WhoAmI on the Web API: the test therefore also validates the application user.

Adapt it

In your handler, use OAuth2ClientCredentialsHelper.ForDynamics365, then build the record from the manifest. See Authentication to your systems.

On failure, the connector's response contains the Dataverse error code and body: it is only read by SESAR, but do not log it as is.