Dynamics CRM

Partner Setup

Dynamics CRM Online uses OAuth 2. Please sign up for an application on Microsoft first and get an OAuth client ID and client secret.

See here for the official documentation for creating an Azure Active Directory application.

We will summarise it in a few points:

  1. Register a free Azure account or Dynamics Online trial account; log into your Azure or Dynamics Online account if you already have one.
  2. Go to Microsoft Azure portal -> Azure Active Directory -> App Registrations -> New application registration.

    Below are the details you should provide:

    Name: Your Application Name

    Application type: Web app / API

    Reply URLs: you must add a callback URL to allow Dynamics CRM to be used in your Cyclr Console and its accounts.

    The URL is:

    • https://{{Your Cyclr service domain e.g. app-h.cyclr.com}}/connector/callback

    Multi-tenanted: Yes

    Required Permissions: Dynamics CRM Online and Windows Azure Active Directory

  3. Go to Cyclr Console (https://yourCyclrInstance/console) > Connectors > Connector Library > Dynamics CRM Online > Setup

    Client ID: This is the Application ID displayed in the portal

    Client Secret: Create a Password under Microsoft Azure portal > Azure Active Directory > App Registrations > Your Application > API Access > Keys. Copy and paste the password as the client secret

Dynamics CRM Online connector is now set up! You can test it by installing it in one of your customer accounts.

API Integration Guide

Dynamics CRM Online uses OAuth 2 Authorisation Code. The only thing to set up before getting an authentication token is to provide the domain of your Dynamics CRM Online instance.

To do this, create an account connector property named Resource:

curl -X POST 
     -H 'Content-Type: application/json' 
     -H 'Accept: application/json' 
     -d '{
            "Name": "Resource",
            "Value": "https://example.crm.dynamics.com"
         }'
'https://yourCyclrInstance/v1.0/account/connectors/DYNAMICS_ACCOUNT_CONNECTOR_ID/properties'

After successfully creating the account connector property, you can get a one-time sign-in token and call /UpdateAccountConnectorOAuth to complete the user challenge.

FAQ

Error: AADSTS500011

If you encounter the error AADSTS500011: The resource principal named [Resource URL] was not found in the tenant named [Tenant ID]. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

Ensure you’re using the correct Resource URL in the Connector’s Setup. This is the URL of your Dynamics account and should be similar to “https://mycompany.crmXX.dynamics.com”. If unsure, login to your Dynamics account through your web browser and copy it from the address bar.

Error: AADSTS65001

Follow the below step if you are getting the error AADSTS65001: The user or administrator has not consented to use the application with ID ” named ”. Send an interactive authorization request for this user and resource.

  1. Go to Microsoft Azure portal -> Azure Active Directory -> App registrations -> Your App name -> API permissions
  2. Click the “Grant admin consent for …” button to allow the app to be installed in your own directory. If the button is greyed out, your user doesn’t have the appropriate permission.

Additional Filter Condition

Some methods provide “Additional Filter Condition” field. This can be used to filter results. The full MS Dynamics documentation is here. e.g. “and myCustomBool eq true” Warning: Ensure lowercase is used for the operators. i.e. AND will not work, and will work.

Additional Fields To Return

Some methods provide “Additional Fields To Return” field. This can be used to return addtional data. e.g. Add a custom response field to the method and add the custom field to Additional Fields To Return, to tell the API to return. If there is more than one field use “,” seperator.

Tags: connector
Edit me