# mulesoft Microsoft Dynamics 365 Connector - Full Documentation --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Microsoft Dynamics 365 Connector 2.6 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Microsoft Dynamics 365 (Microsoft Dynamics 365 Connector) enables integration with the Microsoft Dynamics 365 Cloud API. This connector enables you to perform operations to: - Authorize or unauthorize server access - Create, update, and delete entities - Retrieve a single entity or query multiple entities - Associate and disassociate entities - Execute actions Release Notes: [Microsoft Dynamics 365 Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/microsoft-dynamics-365-connector-release-notes-mule-4) Exchange: [Microsoft Dynamics 365 Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-microsoft-dynamics365-connector/) ## Before You Begin Before creating an app, you must have access to the Microsoft Dynamics 365 target resource and Anypoint Platform. You also must understand how to create a Mule app using Anypoint Studio. Obtain a client ID and secret for your app by logging in to the Microsoft Azure Active Directory portal at portal.azure.com. Before starting: You need access to a Microsoft Dynamics 365 instance for which Azure Active Directory is the Identity Provider that provides access to an application. ## Common Use Cases for the Connector Common use cases for Microsoft Dynamics 365 Connector include: - **Entity Management** Create, retrieve, update, or delete entities: - Create an account with attributes that associate an account with a contact - Create an empty contact entity - Create an empty opportunity entity - Create multiple entities of the same type in a single batch request - Delete an entity by type - Disassociate keys based on an identity ID - Retrieve an entity by type - Retrieve multiple entities using a URL request - Retrieve multiple entities using DataSense query language - Update an account with attributes - Update multiple entities of the same type in a single batch request - **Automated Business Processes** Automate businesses processes across sales, marketing, social media, and customer service departments with seamless communication to keep your enterprise connected. - **Data Synchronization** Perform data migration, social data synchronization, and lead and contact data sharing. For examples of these use cases, refer to [Microsoft Dynamics 365 Connector Examples](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-examples). ## Audience - New users, read: - [Using Anypoint Studio to Configure the Connector](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-studio) to create your Mule app - [Examples](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-examples), which provides an example use case for the connector - Advanced users, read: - [XML and Maven Support](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-xml-maven) - [Examples](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-examples), which provides an example use case for the connector ## Authentication Types Microsoft Dynamics 365 Connector uses the following authentication types: - **Connection** (OAuth 2.0) Connects to servers that manage authorization and token access - **OAuth 2.0 client credentials** Uses a client ID and client secret to authenticate the connection to the server - **OAuth 2.0 username and password** Uses a username and password to authenticate the connection to the server ## Terminology Actions Operations that allow side effects, such as data modification, cannot be further composed to avoid non-deterministic behavior. Complex types Keyless structured types consisting of a set of properties. Complex types are commonly used as property values in model entities, or as parameters or return values for operations. Entities Instances of entity types, for example, an account or an opportunity. Entity set Collections of entities, for example, an account is an entity set containing account entities. An entity’s key uniquely identifies the entity within an entity set. Entity types Structured types with a key. Entity types define the properties and relationships of an entity, and may derive by single inheritance from other entity types. Enumeration types or enum types Primitive types whose values are constants with underlying integer values. Functions Operations that do not have side effects and may support further composition, for example, with additional filter operations, functions, or an action. ## Using Exchange Templates and Examples [Anypoint Exchange](https://www.mulesoft.com/exchange/) provides templates that you can use as starting points for your apps and examples that illustrate a complete solution. ## Next Step After you have met the prerequisites and experimented with templates and examples, you are ready to create an app with [Anypoint Studio](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Microsoft Dynamics 365 Connector 2.6 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You can better understand how to use Microsoft Dynamics 365 Connector if you build and run a demonstration project. ## Mule Flows Overview The example that follows contains the following `` elements: - `CREATE_EMPTY_CONTACT_DEMO` Creates an empty contact entity that is required later in other flows. \[GET\] The HTTP endpoint listens to the following URL: `http://localhost:8081/createContact` - `CREATE_EMPTY_OPPORTUNITY_DEMO` Creates an empty opportunity entity that is required later in other flows. \[GET\] The HTTP endpoint listens to the following URL: `http://localhost:8081/createOpportunity` - `CREATE_ACCOUNT_DEMO` Creates an account with specified attributes and also associates the account with a contact. \[POST\] HTTP endpoint listens to the following URL: `http://localhost:8081/createAccount` Request example: `{"AccountName":"Test Account Name","CreditOnHold":true,"CreditLimit":1000,"ContactID":""}` - `CREATE_MULTIPLE_ENTITIES_DEMO` Creates multiple entities of the same type in a single batch request. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/createMultipleAccounts` Request example: `[{"AccountName":"Account Name 1","CreditOnHold":true,"CreditLimit":1500},{"AccountName":"Account Name 2","CreditOnHold":false,"CreditLimit":2000}]` - `UPDATE_MULTIPLE_ENTITIES_DEMO` Updates multiple entities of the same type in a single batch request. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/updateMultipleAccounts` Request example: `[{"EntityId":"","AccountName":"Updated Name 1"},{"EntityId":"","AccountName":"Updated Name 2"}]` - `DELETE_ENTITY_DEMO` Deletes an entity of a specified type. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/deleteAccount` Request example: `{"EntityId":""}` - `RETRIEVE_ENTITY_DEMO` Retrieves an entity of a specified type. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/retrieveAccount` Request example: `{"EntityId":""}` - `RETRIEVE_ENTITIES_BY_URL_DEMO` Retrieves multiple entities based on a URL request. \[GET\] The HTTP endpoint listens to the following URL: `http://localhost:8081/retrieveAccountsByURL` - `RETRIEVE_ENTITIES_BY_QUERY_DEMO` Retrieves multiple entities based on Datasense Query Language. \[GET\] The HTTP endpoint listens to the following URL: `http://localhost:8081/retrieveAccountsByQuery` - `DISASSOCIATE_ENTITIES_DEMO` Disassociates entities. You provide the ID of the entity upon which the request was made and the keys to be disassociated. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/disassociateEntities` Request example: `{"EntityId":"","EntityLinkKeys":["primarycontactid"]}` - `DO_ACTION_DEMO` Calls the `WinOpportunity` action. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/doAction` Request example: `{"Subject":"Won Opportunity","Status":3,"OpportunityId":""}` Browse to `http://localhost:8081` to test the flows, or you can POST JSONs using a tool like curl, or any other tool (Chrome/Mozilla Firefox extensions) that lets you POST a body when calling the URL. ## Test the Flows 1. Specify your OAuth2 credentials for OAuth2 Username Password Config in /src/main/resources/mule-artifact.properties: - `config-oauth-user-pass.username` Username to initialize the session - `config-oauth-user-pass.password` Password used to authenticate the user - `config-oauth-user-pass.resource` App ID URI of the web API (secured resource). It must be the root URI, without specifing the CRM version: for example, `[https://.crm2.dynamics.com/](https://\.crm2.dynamics.com/)`. - `config-oauth-user-pass.clientId` App ID assigned to your app when you registered it with Azure Active Directory. You can find this in the Azure portal. - `config-oauth-user-pass.clientSecret` Application secret that you created in the app registration portal for your app. The secret should not be used in a native app, because client secrets cannot be reliably stored on devices. The secret is required for web apps and web APIs, which have the ability to store the client secret securely on the server side. - `config-oauth-user-pass.tokenRequestEndpoint` Token endpoint that is called to get the access token: for example, `[https://login.windows.net//oauth2/token](https://login.windows.net/\/oauth2/token)`, where 'tenant-id' is the Azure Active Directory ID. 2. Specify a DataSense connection timeout over 200 seconds, because the connector makes several requests to provide DataSense information. 3. Run the project in Studio. 4. Type `localhost:8081` in your browser to access the selection menu of the demo. 5. Optionally configure Connection Timeout and Read Timeout. Connection Timeout is the timeout in making the initial connection with the server. Read Timeout is the timeout on waiting to read data from the server. ## Mule XML Flow ```example #[payload] #[payload] #[payload] #[payload] #[payload.EntityId] #[payload.EntityId] ${config-oauth-user-pass.resource}/api/data/v8.2/accounts?$select=name,accountnumber&$top=3 dsql:SELECT accountid,accountnumber,name FROM accounts LIMIT 2 #[payload] ``` ## Update an Entity 1. Add the Microsoft Dynamics 365 Update operation. 2. Specify the logical name (required), which is the name of the schema in lowercase. 3. Define optional attributes for the default. The entity ID is a required attribute that indicates which entity instance to update. ### Example: Update Entity Updates an account with specified attributes. \[POST\] The HTTP endpoint listens to the following URL: `http://localhost:8081/updateAccount` ### Request Example ```json { "EntityId": "", "AccountName": "Updated Name", "CreditLimit": 1500 } ``` ### Flow Definition ```xml #[payload] ``` ## Link Records Between Entities Establish relationships between entities using the OData bind annotation with the syntax: `"@odata.bind": "/()"` ### Example: Link Contact to Customer This example creates a Contact record and links it to an existing Customer (Account). ```dataweave %dw 2.0 output application/java --- { firstname: payload.FirstName, lastname: payload.LastName, emailaddress1: payload.EmailAddress, "parentcustomerid@odata.bind": "/accounts(" ++ payload.CustomerId ++ ")" } ``` Common navigation properties: - `parentcustomerid@odata.bind` - Links a Contact to an Account (Customer) - `primarycontactid@odata.bind` - Links an Account to a primary Contact - `customerid@odata.bind` - Links an entity to a Customer (Account or Contact) > [!NOTE] For polymorphic lookups that accept multiple entity types, append the entity type suffix: > `parentcustomerid_account@odata.bind` for Accounts or `parentcustomerid_contact@odata.bind` for > Contacts. You can link multiple relationships by including multiple `@odata.bind` annotations in the same payload. ## See Also [Salesforce Help](https://help.salesforce.com) --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Microsoft Dynamics 365 Connector 2.6 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Microsoft Dynamics 365 (Microsoft Dynamics 365 Connector) enables integration with the Microsoft Dynamics 365 Cloud API. ## Configuration Default Configuration for Microsoft Dynamics 365 Connector.
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

### Connection (OAuth 2.0) Connection Type Use OAuth 2.0 to delegate user authentication to the service hosting the user account. For more information, refer to [Configuring OAuth 2.0 for Connectors](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2), [Configuring OAuth 2.0 for Connectors on CloudHub](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2-cloudhub), or [OAuth Support in the SDK](https://docs.mulesoft.com/mule-sdk/latest/oauth). Connects to servers that manage authorization and token access.
NameTypeDescriptionDefault ValueRequired

Version

String

Version number of the API to connect to.

9.0

(Deprecated) Scope

String

Do not use this parameter. This parameter cannot be used for the authentication request. The authentication fails if both the Scope and Scopes parameters are used, since they both provide the same functionality. This parameter will be removed in a future version.

openid

Resource

String

Endpoint URL.

x

Response Type

String

Response type must be query.

query

Read Timeout

Number

How long the consumer waits for a response before it times out, in milliseconds. Default value is 0, which means infinite.

0

Connection Timeout

Number

How long the connector waits before timing out when establishing a connection to the remote service. Default value is 0, which means infinite.

0

Host

String

Hostname of the proxy. If this property is not set, then no proxy is used; otherwise, a proxy is used, but a proxy host must be specified.

Port

Number

Port of the proxy. If Host is set, then this property must be set and cannot be a negative number.

Username

String

Username used to authenticate against the proxy. If this property is not set, then authentication is not applied to the proxy.

Password

String

Password used to authenticate against the proxy.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

Consumer Key

String

OAuth consumer key, as registered with the service provider.

x

Consumer Secret

String

OAuth consumer secret, as registered with the service provider.

x

Authorization Url

String

URL of the service provider’s authorization endpoint.

https://login.microsoftonline.com/oauth2/authorize

Access Token Url

String

URL of the service provider’s access token endpoint.

https://login.microsoftonline.com/oauth2/token

Scopes

String

OAuth scopes to request during the OAuth dance. This value defaults to the scopes in the annotation.

Resource Owner Id

String

Resource owner ID to use if the component does not have another reference.

Before

String

Name of the flow to execute immediately before starting the OAuth dance.

After

String

Name of the flow to execute immediately after receiving an access token.

Listener Config

String

Configuration for the HTTP listener that listens for requests on the access token callback endpoint.

x

Callback Path

String

Path of the access token callback endpoint.

x

Authorize Path

String

Path of the local HTTP endpoint that triggers the OAuth dance.

x

External Callback Url

String

URL that the OAuth provider uses to access the callback endpoint if the endpoint is behind a proxy or accessed through an indirect URL.

Object Store

String

Configures the object store that stores data for each resource owner. If not configured, Mule uses the default object store.

### OAuth Client Credentials Connection Type Use OAuth 2.0 to delegate user authentication to the service hosting the user account. For more information, refer to [Configuring OAuth 2.0 for Connectors](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2), [Configuring OAuth 2.0 for Connectors on CloudHub](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2-cloudhub), or [OAuth Support in the SDK](https://docs.mulesoft.com/mule-sdk/latest/oauth). Uses a client ID and a client secret to authenticate the connection to the server.
NameTypeDescriptionDefault ValueRequired

Version

String

Version number of the API to connect to.

9.0

Endpoint

String

Location where to send the requests.

x

Read Timeout

Number

How long the consumer waits for a response before it times out, in milliseconds. Default value is 0, which means infinite.

0

Connection Timeout

Number

How long the connector waits before timing out when establishing a connection to the remote service. Default value is 0, which means infinite.

0

Host

String

Hostname of the proxy. If this property is not set, then no proxy is used; otherwise, a proxy is used, but a proxy host must be specified.

Port

Number

Port of the proxy. If Host is set, then this property must be set and cannot be a negative number.

Username

String

Username used to authenticate against the proxy. If this property is not set, then authentication is not applied to the proxy.

Password

String

Password used to authenticate against the proxy.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

Client ID

String

OAuth client ID, as registered with the service provider.

x

Client secret

String

OAuth client secret, as registered with the service provider.

x

Token url

String

The service provider’s token endpoint URL.

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

Scopes

String

OAuth scopes to request during the OAuth dance. This value defaults to the scopes in the annotation.

Object Store

String

Configures the object store that stores data for each resource owner. If not configured, Mule uses the default object store.

### OAuth Username Password Connection Type Uses a username and a password to authenticate the connection to the server.
NameTypeDescriptionDefault ValueRequired

Version

String

Version number of the API to connect to.

9.0

Read Timeout

Number

How long the consumer waits for a response before it times out, in milliseconds. Default value is 0, which means infinite.

0

Connection Timeout

Number

How long the connector waits before timing out when establishing a connection to the remote service. Default value is 0, which means infinite.

0

Host

String

Hostname of the proxy. If this property is not set, then no proxy is used; otherwise, a proxy is used, but a proxy host must be specified.

Port

Number

Port of the proxy. If Host is set, then this property must be set and cannot be a negative number.

Username

String

Username used to authenticate against the proxy. If this property is not set, then authentication is not applied to the proxy.

Password

String

Password used to authenticate against the proxy.

Username

String

Username used to initialize the session.

x

Password

String

Password used to authenticate the user.

x

Resource

String

Application ID URI of the web API (secured resource).

x

Client Id

String

Application ID assigned to your application when you register the application with Azure AD. You can find this Client Id in the Azure Portal. Click Active Directory, select the directory, choose the application, and click Configure.

x

Client Secret

String

Application secret that you create in the application registration portal for your application. This Client Secret must not be used in a native app, because client secrets cannot be reliably stored on devices. It is required for web apps and web APIs, which store the client secret securely on the server side.

x

Token Request Endpoint

String

Token request endpoint.

x

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Sources - [On Deleted Object Listener](#on-deleted-object) - [On Modified Object](#on-modified-object) - [On New Object](#on-new-object) > [!NOTE] Microsoft Dynamics 365 Connector sources use Object Store to save watermarks. You might > experience limitations that are specific to the Object Store implementation you are using (Object > Store for CloudHub deployments or Object Store for on-premises deployments), so configure Object > Store to suit your needs. > For more information, see > [The Different Types of Object Stores Explained](https://help.salesforce.com/s/articleView?id=001123185&type=1). ### On Deleted Object Listener `` Starts your app when an object is deleted.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Entity Type

String

Describes business data. Example values are account and contact, which are defined in the Microsoft Dynamics 365 instance.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

Scheduling Strategy

Scheduling Strategy

Configures the scheduler that triggers the polling.

x

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

Attributes Type

Any

#### Associated Configurations - [Configuration](#dynamics-config) ### On Modified Object `` Starts your app when an object is modified.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Since

String

Required date format is 'yyyy-MM-dd’T’HH:mm:ss’Z'.

Entity Type

String

Describes business data. Example values are account and contact, which are defined in the Microsoft Dynamics 365 instance.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

Scheduling Strategy

Scheduling Strategy

Configures the scheduler that triggers the polling.

x

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

Attributes Type

Any

#### Associated Configurations - [Configuration](#dynamics-config) ### On New Object `` Starts your app when a new object is created.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Since

String

Required date format is 'yyyy-MM-dd’T’HH:mm:ss’Z'.

Entity Type

String

Describes business data. Example values are account and contact, which are defined in the Microsoft Dynamics 365 instance.

x

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

Scheduling Strategy

Scheduling Strategy

Configures the scheduler that triggers the polling.

x

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

Attributes Type

Any

#### Associated Configurations - [Configuration](#dynamics-config) ## Operations - [Create](#create) - [Create Multiple](#createMultiple) - [Delete](#delete) - [Delete Multiple](#deleteMultiple) - [Disassociate](#disassociate) - [Do Action](#doAction) - [Invoke](#invoke) - [Retrieve](#retrieve) - [Retrieve Multiple](#retrieveMultiple) - [Retrieve Multiple By Query](#retrieveMultipleByQuery) - [Unauthorize](#unauthorize) - [Update](#update) - [Update Multiple](#updateMultiple) ### Create `` Creates a new entity. - Create New Entity - `https://msdn.microsoft.com/en-us/library/gg328090.aspx` - Associate Entity Upon Creation - `https://msdn.microsoft.com/en-us/library/mt607875.aspx#Anchor_4`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Attributes

Object

Attributes of the entity to create as a map.

#[payload]

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

String

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Create Multiple `` Creates multiple entities. - Create New Entity - `https://msdn.microsoft.com/en-us/library/gg328090.aspx` - Associate Entity Upon Creation - `https://msdn.microsoft.com/en-us/library/mt607875.aspx#Anchor_4` - Batch Request - `https://msdn.microsoft.com/en-us/library/mt607719.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Entities Attributes

Array of Object

List of the entities' attributes to create as a list of maps.

#[payload]

Use Single Transaction

Boolean

Use a single transaction for creation. If the entity creation fails, the transaction is rolled back.

false

Continue On Error

Boolean

Continue in case of error. The default value of false stops creating records after one create fails.

You can use Continue On Error in conjunction with Use Single Transaction. Suppose you want to execute an operation with a payload of 10 records. This payload contains one broken record, number 5, that fails. The other 9 records succeed. The following table shows the output, which depends on the values of Continue On Error and Use Single Transaction:

Use Single TransactionContinue on ErrorExpected resultSuccessful recordsFailed recordsUnprocessed records

False

False

No rollback. Stops processing records after a failed record.

1-4

5

6-10

False

True

No rollback. Continues to process records even after a failed record.

1-4, 6-10

5

N/A

True

False

If the connector fails to create an entity, no records are committed.

N/A

Failed records 1-10

N/A

True

True

If the connector fails to create an entity, no records are committed.

N/A

Failed records 1-10

N/A

false

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Bulk Operation Result

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Delete `` Deletes an entity. - Delete an Entity - `https://msdn.microsoft.com/en-us/library/mt607664.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Id

String

ID of the entity to delete.

#[payload]

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Delete Multiple `` Deletes multiple entities. - Delete an Entity - `https://msdn.microsoft.com/en-us/library/mt607664.aspx` - Batch Request - `https://msdn.microsoft.com/en-us/library/mt607719.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Ids

Array of String

List of IDs to delete.

#[payload]

Use Single Transaction

Boolean

Use a single transaction for deletion. If the deletion fails, the transaction is rolled back.

true

Continue On Error

Boolean

Continue in case of error. The default value of false stops deleting records after one delete fails.

You can use Continue On Error in conjunction with Use Single Transaction. Suppose you want to execute an operation with a payload of 10 records. This payload contains one broken record, number 5, that fails. The other 9 records succeed. The following table shows the output, which depends on the values of Continue On Error and Use Single Transaction:

Use Single TransactionContinue on ErrorExpected resultSuccessful recordsFailed recordsUnprocessed records

False

False

No rollback. Stops processing records after a failed record.

1-4

5

6-10

False

True

No rollback. Continues to process records even after a failed record.

1-4, 6-10

5

N/A

True

False

If the connector fails to delete an entity, no records are committed.

N/A

Failed records 1-10

N/A

True

True

If the connector fails to delete an entity, no records are committed.

N/A

Failed records 1-10

N/A

false

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Bulk Operation Result

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Disassociate `` Removes a reference to an entity.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Attributes

Object

Disassociates a request’s payload.

#[payload]

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Do Action `` Call an action. - Use Web API Actions - `https://msdn.microsoft.com/en-us/library/mt607600.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Action Name

String

Action name to call.

x

Bounded Entity Type

String

Optional bounded entity type. You must provide this value if the action is bounded.

Bounded Entity Id

String

Optional bounded entity ID. You must provide this value if the action is bounded.

Related Entities

Object

Body to send in the request as a map.

#[payload]

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Invoke `` Generic simple invoke.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Uri

String

URI to invoke.

x

Http Method

Enumeration, one of:

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

HTTP method to invoke.

x

Headers

Object

HTTP headers used in the request.

Body

String

String placed in the body of the request.

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Retrieve `` Retrieves an entity. - Retrieve an Entity - `https://msdn.microsoft.com/en-us/library/mt607871.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Id

String

ID of the entity to retrieve.

#[payload]

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Object

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Retrieve Multiple `` Retrieve multiple by URL. - Query Data using the Web API - `https://msdn.microsoft.com/en-us/library/gg334767.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Data Query URL

String

URL to use for data retrieval.

x

Page Size

Number

Number of items in a results page.

5000

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configure how Mule processes streams with streaming strategies. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Object

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Retrieve Multiple By Query `` Retrieve multiple by DSQL query. - Query Data using the Web API - `https://msdn.microsoft.com/en-us/library/gg334767.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Datasense Query

String

DSQL query used to retrieve. The query is transformed in a retrieve URL internally.

x

Page Size

Number

Number of items in a results page.

5000

Expand

String

Information about the specified relationship to include in the response.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Streaming Strategy

Configure how Mule processes streams with streaming strategies. Repeatable streams are the default behavior.

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Array of Object

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Unauthorize `` Deletes all the access token information of a given resource owner ID so that it is impossible to execute any operation for that user without doing the authorization dance again.
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Resource Owner Id

String

ID of the resource owner for whom to invalidate access.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

#### Associated Configurations - [Configuration](#dynamics-config) ### Update `` Updates an entity. - Create New Entity - `https://msdn.microsoft.com/en-us/library/gg328090.aspx` - Associate Entity Upon Creation - `https://msdn.microsoft.com/en-us/library/mt607875.aspx#Anchor_4` - Batch Request - `https://msdn.microsoft.com/en-us/library/mt607719.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Attributes

Object

Attributes of the entity.

#[payload]

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ### Update Multiple `` Updates multiple entities. - Update Entity - `https://msdn.microsoft.com/en-us/library/mt607664.aspx` - Associate Entities Upon Update - `https://msdn.microsoft.com/en-us/library/mt607875.aspx#Anchor_4` - Batch Request - `https://msdn.microsoft.com/en-us/library/mt607719.aspx`
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Logical Name

String

Logical name of the entity. It is always the schema name in lower case.

x

Entities Attributes

Array of Object

List of the entities' attributes to create as a list of maps.

#[payload]

Use Single Transaction

Boolean

Use a single transaction for an update. If the update fails, the transaction is rolled back.

false

Continue On Error

Boolean

Continue in case of error. The default value of false stops updating records after one update fails.

You can use Continue On Error in conjunction with Use Single Transaction. Suppose you want to execute an operation with a payload of 10 records. This payload contains one broken record, number 5, that fails. The other 9 records succeed. The following table shows the output, which depends on the values of Continue On Error and Use Single Transaction:

Use Single TransactionContinue on ErrorExpected resultSuccessful recordsFailed recordsUnprocessed records

False

False

No rollback. Stops processing records after a failed record.

1-4

5

6-10

False

True

No rollback. Continues to process records even after a failed record.

1-4, 6-10

5

N/A

True

False

If the connector fails to update an entity, no records are committed.

N/A

Failed records 1-10

N/A

True

True

If the connector fails to update an entity, no records are committed.

N/A

Failed records 1-10

N/A

false

Encoding

Body encoding.

  • If no value is specified, set the Mule default encoding.

  • If a value is specified, set the -M-Dmule.encoding VM argument to the same value to avoid an encoding mismatch.

Config Ref

ConfigurationProvider

Name of the configuration used to execute this component.

x

Target Variable

String

Name of the variable that stores the operation’s output.

Target Value

String

Expression that evaluates the operation’s output. The outcome of the expression is stored in the Target Variable field.

#[payload]

Reconnection Strategy

Retry strategy in case of connectivity errors.

#### Output

Type

Bulk Operation Result

#### Associated Configurations - [Configuration](#dynamics-config) #### Throws - DYNAMICS:CONNECTIVITY - DYNAMICS:INVALID\_PAGE\_SIZE - DYNAMICS:NOT\_FOUND - DYNAMICS:OPERATION\_FAILED - DYNAMICS:PARSE\_ERROR - DYNAMICS:RETRY\_EXHAUSTED - DYNAMICS:TIMEOUT - DYNAMICS:UNAUTHORIZED - DYNAMICS:UNKNOWN ## Object Types - [Bulk Item](#BulkItem) - [Bulk Operation Result](#BulkOperationResult) - [Expiration Policy](#ExpirationPolicy) - [Reconnect](#reconnect) - [Reconnect Forever](#reconnect-forever) - [Reconnection](#Reconnection) - [Redelivery Policy](#RedeliveryPolicy) - [Repeatable File Store Iterable](#repeatable-file-store-iterable) - [Repeatable In Memory Iterable](#repeatable-in-memory-iterable) ### Bulk Item Information about a bulk item.
FieldTypeDescriptionDefault ValueRequired

Exception

Any

Exception if the item fails.

Id

Any

Item ID.

Message

String

Message to add context to this item, such as an error description, a warning, or information related to the operation.

Payload

Object

Actual data the entity represents.

Status Code

String

Optional status code.

Successful

Boolean

Whether or not the request is successful.

### Bulk Operation Result Information about a bulk operation.
FieldTypeDescriptionDefault ValueRequired

Id

Any

Operation ID.

Items

Array of Bulk Item

Ordered list of bulk items.

Successful

Boolean

Whether or not the operation is successful. Must be true if and only if all the child DynamicsBulkItem entities are also successful.

### Expiration Policy Configures an expiration policy strategy.
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

What to do if, when an app is deployed, a connectivity test does not pass after exhausting the associated reconnection strategy:

  • true

    Allow the deployment to fail.

  • false

    Ignore the results of the connectivity test.

Reconnection Strategy

Reconnection strategy to use.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Id Expression

String

One or more expressions that determine if a message is redelivered. This property can be set only if the Use Secure Hash field is false.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Repeatable File Store Iterable Repeatable file store iterable type.
FieldTypeDescriptionDefault ValueRequired

Max In Memory Size

Number

Maximum amount of instances to keep in memory. If more than that is required, content on the disk is buffered.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Max In Memory Size field.

### Repeatable In Memory Iterable Repeatable in memory iterable type.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Amount of instances to initially keep in memory to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then the buffer expands according to the Buffer Size Increment attribute, with an upper limit of Max In Memory Size. Default value is 100 instances.

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of 0 or lower means that the buffer must not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full. Default value is 100 instances.

Max Buffer Size

Number

Maximum amount of memory to use. If more than that is used, a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised. A value lower than or equal to 0 means no limit.

## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Microsoft Dynamics 365 Connector 2.6 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt If you manually code a Mule app in XML either from the Anypoint Studio XML editor or from a text editor, you can get access to the Microsoft Dynamics 365 Connector in your app by adding reference statements to your XML Mule flow and in the Apache Maven pom.xml file. > [!NOTE] You can avoid the manual process described in this topic by using Studio. When you install > Microsoft Dynamics 365 Connector in Anypoint Studio, Studio automatically populates the XML code > with the Microsoft Dynamics 365 Connector namespace and schema location, and adds a dependency to > the pom.xml file. ## Add a Namespace for the Connector Paste the following code inside the `mule` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/microsoft-dynamics-365 http://www.mulesoft.org/schema/mule/microsoft-dynamics-365/current/mule-microsoft-dynamics-365.xsd ``` This example shows how the namespace statements are placed in the XML: ```xml ``` ## Add a POM File Dependency The Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your pom.xml file to enable access to the connector. ```xml com.mulesoft.connectors mule-microsoft-dynamics365-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information, access the connector in [Anypoint Exchange](https://www.mulesoft.com/exchange/) and click **Dependency Snippets**. ## Next Step After completing your namespace and `pom.xml` file, you can try the [Examples](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-examples). ## See Also - [Salesforce Help](https://help.salesforce.com) --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Troubleshooting Microsoft Dynamics 365 Connector 2.6 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for Microsoft Dynamics 365 (Microsoft Dynamics 365 Connector), become familiar with the information about interpreting commonly thrown exception messages. ## Enable Verbose Exception Logging Enable verbose exception logs to show a complete stack trace of the error instead of the default truncated output: 1. In Studio, right-click on the project and select **Run > Run Configurations**. 2. Go to the **Arguments** tab and append the arguments in the **VM arguments** section to add the `mule.verbose.exceptions` property. For example: `-XX:PermSize=128M -XX:MaxPermSize=256M -Dmule.verbose.exceptions=true` ## Enable Verbose Logging To get a better understanding of why an application’s interaction with Microsoft Dynamics 365 Connector is failing, temporarily enable verbose logging for the connector. Remember to always disable enhanced verbosity after troubleshooting, because it can affect your Mule application’s performance. To enable verbose logging in the configuration file: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add an `` tag inside the `` tag: ```xml ... ... ``` 6. Save your application changes. 7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. ## Understand Commonly Thrown Exceptions Here is a list of commonly thrown exception messages and how to interpret them: - DYNAMICS:CONNECTIVITY Either a connection could not be established or there is a connectivity error. - DYNAMICS:INVALID\_PAGE\_SIZE The page size is invalid, for example, if the fetch size value exceeds 5000. - DYNAMICS:NOT\_FOUND The server could not find the requested resource. - DYNAMICS:OPERATION\_FAILED The operation fails, for example, if the protocol or entity attributes are invalid or if invocation fails. - DYNAMICS:PARSE\_ERROR There is an error when parsing a JSON entity, for example, the entity ID is invalid or the encoding for the provided JSON is invalid. - DYNAMICS:RETRY\_EXHAUSTED The consumer is not subscribed to any topics, and no manually assigned partitions are set to consume from. - DYNAMICS:TIMEOUT A specific request takes longer than the configuration timeout values. - DYNAMICS:UNAUTHORIZED There is an unauthorized request. - DYNAMICS:UNKNOWN There is an unknown or an unexpected error. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Microsoft Dynamics 365 Connector Reference](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-reference) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: Microsoft Dynamics 365 Connector version: 2.6 is-latest-version: true --- # Using Anypoint Studio to Configure Microsoft Dynamics 365 Connector 2.6 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). When you run the connector, you can view the app log to check for problems, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [Microsoft Dynamics Reference](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Microsoft Dynamics 365 Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `dynamics 365` in the search field. 3. Click **Microsoft Dynamics 365** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Microsoft Dynamics 365 Connector: - **On new object** starts your app when an object is created - **On modified object** Starts your app when an object is modified - **On deleted object** Starts your app when an object is deleted - **HTTP > Listener** Initiates a flow each time it receives a request on the configured host and port - **Scheduler** Initiates a flow when a time-based condition is met For example, to configure an **On New Object** source, follow these steps: 1. In the **Mule Palette** view, select **Dynamics 365 > On new object**. ![On New Object source selected in Mule Palette view](/mulesoft/current/en-us/microsoft-dynamics-365-connector/latest/_images/dynamics-365-select-on-new-object.png) 2. Drag **On new object** to the Studio canvas. 3. On the **On new object** **General** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Entity type** field, for example `account`. The entity type string describes business data that is defined in the Microsoft Dynamics 365 instance. ![General configuration fields for On New Object source](/mulesoft/current/en-us/microsoft-dynamics-365-connector/latest/_images/dynamics-365-on-new-object-general.png) 5. Click the plus sign (+) next to the **Connector configuration** field to configure a global element that can be used by all instances of the **On new object** source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for Microsoft Dynamics 365 Connector, follow these steps: 1. In the **Mule Palette** view, select **Dynamics 365** and then select the desired operation. 2. Drag the operation onto the Studio canvas and to the right of the input source. ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials that the connector requires to access the target Microsoft Dynamics 365 system. Microsoft Dynamics 365 Connector supports the OAuth connection, OAuth client credentials, and OAuth username and password authentication types. To configure the global element for Microsoft Dynamics 365 Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (+) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the authentication method to configure: - [Connection (OAuth 2.0 authentication)](#oauth-connection) - [OAuth 2.0 client credentials authentication](#oauth-client-credentials-connection) - [OAuth 2.0 username and password authentication](#oauth-username-password) 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mule can connect with the specified server. 6. Click **OK**. ### OAuth 2.0 Authentication Use OAuth 2.0 to delegate user authentication to the service hosting the user account. For more information, refer to [Configuring OAuth 2.0 for Connectors](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2), [Configuring OAuth 2.0 for Connectors on CloudHub](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2-cloudhub), or [OAuth Support in the SDK](https://docs.mulesoft.com/mule-sdk/latest/oauth). OAuth 2.0 delegates user authentication to the service hosting the user account. To configure OAuth 2.0 authentication: 1. Enter the following required information on the **General** tab of the **Global Element Properties** screen: - **Resource** Resource URL for accessing the Microsoft Dynamics 365 instance - **Consumer Key** OAuth consumer key registered with the service provider - **Consumer Secret** OAuth consumer secret registered with the service provider - **Listener Config** A reference to the listener that catches the access token callback endpoint - **Callback Path** The path of the access token callback endpoint - **Authorize Path** The path of the local HTTP endpoint that triggers the OAuth dance The following image shows an example OAuth Connection configuration using property placeholder values: ![Global element configuration for OAuth Connection](/mulesoft/current/en-us/microsoft-dynamics-365-connector/latest/_images/dynamics-oauth-connection.png) For the **Authorization url** and **Access token url**, replace the variables `` and `` with your own authorization and access URL tokens. 2. Call the `/authorize` path by pasting it into a web page. 3. On the returned web page, perform the authorization steps by providing your credentials, and so on. After you complete the proper authorization steps, the web page is automatically redirected to the path you configured inside the **Callback Path** field, for example, `/oauth2callback`. This redirect contains additional properties, including an access code for the connector to use. Once the app is authorized, the connector refreshes the token automatically. However, in the event of a restart, you must call the `/authorize` path again and perform the authorization steps. ### OAuth 2.0 Client Credentials Authentication Use OAuth 2.0 to delegate user authentication to the service hosting the user account. For more information, refer to [Configuring OAuth 2.0 for Connectors](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2), [Configuring OAuth 2.0 for Connectors on CloudHub](https://docs.mulesoft.com/connectors/introduction/intro-config-oauth2-cloudhub), or [OAuth Support in the SDK](https://docs.mulesoft.com/mule-sdk/latest/oauth). With OAuth 2.0 client credentials authentication, clients authenticate themselves by using a client ID and client secret. To configure OAuth 2.0 client credentials authentication, enter the following required information on the **General** tab of the **Global Element Properties** screen: - **Endpoint** Location where to send the requests - **Client id** The OAuth client ID, as registered with the service provider - **Client secret** The OAuth client secret, as registered with the service provider The following image shows an example OAuth client credentials configuration using property placeholder values: ![Global element configuration for OAuth 2.0 client credentials](/mulesoft/current/en-us/microsoft-dynamics-365-connector/latest/_images/dynamics-365-oauth-client-credentials.png) ### OAuth 2.0 Username and Password Authentication With OAuth 2.0 username and password authentication, the app makes a POST request that includes a username and password. If the credentials are valid, the server returns an access token. To configure OAuth 2.0 username and password authentication, enter the following information on the **General** tab of the **Global Element Properties** screen: - **Username** User name used to initialize the session. - **Password** Password used to authenticate against the proxy - **Resource** Application ID URI of the web API’s secured resource - **Client ID** Application ID assigned to your app when you registered it with Azure AD. You can find this in the Azure Portal: 1. Go to the Azure portal. 2. Click **Active Directory**, and select the directory. 3. Click the application, and then click **Configure**. - **Client Secret** App secret that you created in the app registration portal for your app The app secret should not be used in a native app, because client secrets cannot be reliably stored on devices. It is required for web apps and web APIs, which have the ability to store the client secret securely on the server side. - **Token Request Endpoint** URL of the OAuth token request server The following image shows an example OAuth username and password configuration using property placeholder values: ![Global element configuration for OAuth 2.0 username and password](/mulesoft/current/en-us/microsoft-dynamics-365-connector/latest/_images/dynamics-365-oauth-username-password.png) ## Run a Flow 1. In Package Explorer, right-click your project’s name and click **Run As** > **Mule Application**. 2. Check the console to see when the application starts. You should see messages such as these if no errors occur: ```text ************************************************************ INFO 2019-10-14 22:12:42,003 [main] org.mule.module.launcher.DeploymentDirectoryWatcher: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Mule is up and kicking (every 5000ms) + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INFO 2019-10-14 22:12:42,006 [main] org.mule.module.launcher.StartupSummaryDeploymentListener: ********************************************************** * - - + DOMAIN + - - * - - + STATUS + - - * ********************************************************** * default * DEPLOYED * ********************************************************** ************************************************************************ * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - * ************************************************************************ * myapp * default * DEPLOYED * ************************************************************************ ``` ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## Next Step After you configure a global element and connection information, see the [Examples](https://docs.mulesoft.com/microsoft-dynamics-365-connector/latest/microsoft-dynamics-365-connector-examples) topic for more configuration information. ## See Also - [Salesforce Help](https://help.salesforce.com)