Skip to main content

Microsoft Dynamics 365 Component

Query, create, update or delete Microsoft Dynamics 365 API records

Component key: ms-dynamics

Description

Microsoft Dynamics 365 is a product line of enterprise resource planning (ERP) and customer relationship management (CRM) intelligent business applications. This component gives you the ability to query and modify records within the Microsoft Dynamics 365 platform.

Connections

MS Dynamics OAuth 2.0 Client Credentials

The OAuth 2.0 client credentials flow allows your user to create an Application User to send requests to Dynamics on their behalf. Setting up a client credentials connection is a two-step process:

  1. Create an "App" in Azure
  2. Create an "Application User" in Dynamics

Create an app in Microsoft Azure

  1. Log in to Azure Portal
  2. Select App registrations
  3. Click + New registration
    • Supported account types can be Single tenant
    • No Redirect URI is necessary
    • Click Register
  4. Under API permissions click +Add a permission
    • Select Dynamics CRM
    • Check the user_impersonation permission
    • Click Add permissions
  5. Under API permissions click Grant admin concent for (your org)
  6. Under Certificates & secrets click + New client secret
    • Give your certificate a description and expiration date
    • Take note of the value (not the Secret ID) of the client secret.
  7. Returning to the Overview page, take note of Application (client) ID
  8. From the Overview page, click Endpoints and take note of the OAuth 2.0 token endpoint (v2)

You will use the Secret Value, Client ID and Token Endpoint in a moment.

Add the app as an App User to Dynamics

  1. Log in to Power Platform admin center
  2. Select Environments and choose your Dynamics Environments
  3. Select S2S Apps
  4. Click +New app user
    • Click +Add an app
    • Choose the app you created in Azure portal (above). You can search for your app by entering the client ID you noted.
    • Select your Dynamics tenant as your Business unit
    • Under Security Roles select System Administrator
    • Click Create

Configure the connection in Prismatic

Within Prismatic, create a connection of type MS Dynamics OAuth 2.0 Client Credentials.

  • Enter the Token Endpoint you noted as your Token URL.
  • Enter the Client ID and Secret Value you noted above.
  • Log in to Dynamics and take note of the Dynamics URL.
    • Enter that Dynamics URL as the Web API URL. It should look like https://REPLACE-ME.crm.dynamics.com/
    • Under scopes, enter the Dynamics URL with .default appended to it - https://REPLACE-ME.crm.dynamics.com/.default
InputNotesExample
Client ID
string
/ Required
clientId
Generated when you register an app in Azure portal
 
Client secret value
password
/ Required
clientSecret
Generated when you register an app in Azure portal
 
Scopes
string
/ Required
scopes
This should be your Dynamics URL with '/.default' appened to it
https://REPLACE-ME.api.crm.dynamics.com/.default
Token URL
string
/ Required
tokenUrl
This can be found by visiting your app in Azure portal and selecting 'Endpoints'
https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token
Web API URL
string
/ Required
webApiUrl
Your organization's Microsoft Dynamics 365 Web API URL.
https://REPLACE-ME.api.crm.dynamics.com/

MS Dynamics OAuth 2.0 Auth Code

The OAuth 2.0 auth code flow allows your user grant permission to your integration to interact with Dynamics on their behalf.

  1. Log in to Azure Portal
  2. Select App registrations
  3. Click + New registration
    • Supported account types should be Multi-tenant if you intend for customers to authenticate with their own Dynamics instance, or Single-tenant if you intend to authenticate with your own Dynamics instance.
    • Under Redirect URI enter https://oauth2.prismatic.io/callback
    • Click Register
  4. Under API permissions click +Add a permission
    • Select Dynamics CRM
    • Check the user_impersonation permission
    • Click Add permissions
  5. Under Certificates & secrets click + New client secret
    • Give your certificate a description and expiration date
    • Take note of the value (not the Secret ID) of the client secret.
  6. Returning to the Overview page, take note of Application (client) ID

Within Prismatic, create a connection of type MS Dynamics OAuth 2.0 Auth Code.

  • Enter the Client ID and Secret Value you noted above.
  • Log in to Dynamics and take note of the Dynamics URL.
    • Enter that Dynamics URL as the Web API URL. It should look like https://REPLACE-ME.crm.dynamics.com/
    • Under scopes, enter the following, replacing the URL with your Dynamics URL: https://REPLACE-ME.crm.dynamics.com/user_impersonation offline_access
InputDefaultNotesExample
Authorize URL
string
/ Required
Hidden Field
authorizeUrl
https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
The OAuth 2.0 Authorization URL for Microsoft Dynamics 365.
 
Client ID
string
/ Required
clientId
 
 
Client Secret
password
/ Required
clientSecret
 
 
Scopes
string
scopes
A space-delimited set of one or more scopes to get the user's permission to access.
https://REPLACE-ME.crm.dynamics.com/user_impersonation offline_access
Token URL
string
/ Required
Hidden Field
tokenUrl
https://login.microsoftonline.com/organizations/oauth2/v2.0/token
The OAuth 2.0 Token URL for Microsoft Dynamics 365.
 
Web API URL
string
/ Required
webApiUrl
Your organization's Microsoft Dynamics 365 Web API URL.
https://my-org.api.crm.dynamics.com/

Triggers

Webhook

Receive and validate webhook requests from Microsoft Dynamics for webhooks you configure. | key: dynamicsWebhookTrigger


Data Sources

[CRM] Entity Object Selection

A subset of Dynamics CRM Entity Types. | key: getEntitiesMetaData | type: objectSelection

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Default Selected Entity Types
string
Value List
defaultSelectedRecordTypes
The names of the Entity Types to default in a selected state.
Include All Custom Entity Types
boolean
/ Required
includeAllCustomRecordTypes
When true, will include all Custom Entity Types, even those not included in Record Type Name Filter.
Include Only Top Level Record Types
boolean
/ Required
includeOnlyTopLevelRecordTypes
When true, will include only Entity Types that are top-level, meaning not subtypes of other Types, regardless of other filters.
Entity Type Filter
string
Value List
recordTypeFilter
The names or labels of the Entity Types to include; if blank then all types are included. Uses case-insensitive matching.

Actions

[CRM] Batch Entity Actions

Perform multiple create/update/delete actions on Microsoft Dynamics 365 CRM entity records. | key: batchEntityActions

InputDefaultNotesExample
Batch Actions
code
/ Required
actions
A list of up to 1000 create, update or delete actions to perform. Each action must have a 'collection' and an 'action' (create, update or delete). Create or update actions must also have 'data' and can include a boolean 'returnRepresentation' which determines if the full record should be returned after being created or updated. Update or delete actions must also have an entity key.
Connection
connection
/ Required
connection
 
 
 

[CRM] Create Attribute

Create a CRM Attribute on an Entity | key: createAttribute

InputDefaultNotesExample
Attribute Body
code
/ Required
attributeBody
Attribute body payload to send
 
Connection
connection
/ Required
connection
 
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70

[CRM] Create Entity

Create a new Microsoft Dynamics 365 CRM entity record. | key: createEntity

InputNotesExample
Connection
connection
/ Required
connection
 
 
Dynamic Values
data
dynamicValues
 
 
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Field Value
string
Key Value List
fieldValues
The names of the fields and their values to use when creating/updating a record
 

[CRM] Delete Entity

Delete the specified Microsoft Dynamics 365 CRM entity record. | key: deleteEntity

InputNotesExample
Connection
connection
/ Required
connection
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts

[CRM] Get Attribute

Retrieve a single CRM Attribute | key: getAttribute

InputNotesExample
Attribute Type
string
/ Required
attributeType
The type of Attribute to query
Connection
connection
/ Required
connection
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Expand Property Name
string
Value List
expandPropertyNames
The names of entity properties to linked entities that should be included
 
Field Name
string
/ Required
Value List
fieldNames
The names of the fields to retrieve
 

[CRM] Get Current User

Get information about the currently logged in CRM user | key: getCurrentUser

InputNotes
Connection
connection
/ Required
connection
 

{
"data": {
"@odata.context": "https://my-org.crm.dynamics.com/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.WhoAmIResponse",
"BusinessUnitId": "00000000-0000-0000-0000-000000000000",
"UserId": "00000000-0000-0000-0000-000000000000",
"OrganizationId": "00000000-0000-0000-0000-000000000000"
}
}

[CRM] Get Entities Metadata

A subset of Dynamics CRM Entity Types. | key: getEntitiesMetaData

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Default Selected Entity Types
string
Value List
defaultSelectedRecordTypes
The names of the Entity Types to default in a selected state.
Include All Custom Entity Types
boolean
/ Required
includeAllCustomRecordTypes
When true, will include all Custom Entity Types, even those not included in Record Type Name Filter.
Include Only Top Level Record Types
boolean
/ Required
includeOnlyTopLevelRecordTypes
When true, will include only Entity Types that are top-level, meaning not subtypes of other Types, regardless of other filters.
Entity Type Filter
string
Value List
recordTypeFilter
The names or labels of the Entity Types to include; if blank then all types are included. Uses case-insensitive matching.

[CRM] Get Entity

Retrieve a single Microsoft Dynamics 365 CRM entity record. | key: getEntity

InputNotesExample
Connection
connection
/ Required
connection
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Expand Property Name
string
Value List
expandPropertyNames
The names of entity properties to linked entities that should be included
 
Field Name
string
/ Required
Value List
fieldNames
The names of the fields to retrieve
 

[CRM] Get Entity Metadata

Get definition of Microsoft Dynamics 365 CRM entity. | key: getEntityMetaData

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
 
 
Entity Type
string
/ Required
entityType
The type of Entity to retrieve metadata for. Use the singular name here
contact
Use Logical Name for Lookup
boolean
/ Required
lookupField
 
 

[CRM] Query Attributes

Query for CRM Attributes that satisfy the filter expression | key: queryAttributes

InputNotesExample
Attribute Type
string
/ Required
attributeType
The type of Attribute to query
Connection
connection
/ Required
connection
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Expand Property Name
string
Value List
expandPropertyNames
The names of entity properties to linked entities that should be included
 
Field Name
string
/ Required
Value List
fieldNames
The names of the fields to retrieve
 
Filter Expression
string
filterExpression
The filter expression that used for querying entity collections
Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS'

[CRM] Query Entities

Query for Microsoft Dynamics 365 CRM entity records that satisfy the filter expression. | key: queryEntities

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
 
 
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Expand Property Name
string
Value List
expandPropertyNames
The names of entity properties to linked entities that should be included
 
Field Name
string
/ Required
Value List
fieldNames
The names of the fields to retrieve
 
Filter Expression
string
filterExpression
The filter expression that used for querying entity collections
Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS'
Next Page Id
string
nextPageId
The id or cookie to use for retrieving the next page of results when paginating through a large result set
 
Order By Field Name
string
Value List
orderByFieldNames
The names of the fields to order by
 
Records Per Page
data
/ Required
recordsPerPage
100
The number of record to retrieve per page
100

[CRM] Raw Request

Send raw HTTP request to Microsoft Dynamics 365 CRM | key: rawRequest

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
 
 
Data
string
data
The HTTP body payload to send to the URL.
{"exampleKey": "Example Data"}
Debug Request
boolean
debugRequest
false
Enabling this flag will log out the current request.
 
File Data
string
Key Value List
fileData
File Data to be sent as a multipart form upload.
[{key: "example.txt", value: "My File Contents"}]
Form Data
string
Key Value List
formData
The Form Data to be sent as a multipart form upload.
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header
string
Key Value List
headers
A list of headers to send with the request.
User-Agent: curl/7.64.1
Max Retry Count
string
maxRetries
0
The maximum number of retries to attempt.
 
Method
string
/ Required
method
The HTTP method to use.
 
Query Parameter
string
Key Value List
queryParams
A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.
 
Response Type
string
/ Required
responseType
json
The type of data you expect in the response. You can request json, text, or binary data.
 
Retry On All Errors
boolean
retryAllErrors
false
If true, retries on all erroneous responses regardless of type.
 
Retry Delay (ms)
string
retryDelayMS
0
The delay in milliseconds between retries.
 
Timeout
string
timeout
The maximum time that a client will await a response to its request
2000
URL
string
/ Required
url
Input the path only (/api/data/v9.2/accounts?$select=name), The base URL is already included (https://my-org.api.crm.dynamics.com). For example, to connect to https://my-org.api.crm.dynamics.com/api/data/v9.2/accounts?$select=name, only /api/data/v9.2/accounts?$select=name is entered in this field.
/accounts?$select=name
Use Exponential Backoff
boolean
useExponentialBackoff
false
Specifies whether to use a pre-defined exponential backoff strategy for retries.
 

[CRM] Run Fetch XML Query

Execute a fetch XML query against your Microsoft Dynamics 365 CRM instance. | key: fetchXml

InputNotesExample
Connection
connection
/ Required
connection
 
 
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Impersonate User Id
string
impersonateUserId
Specifies the GUID of a user to impersonate when executing the query
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Include Annotations
string
includeAnnotations
Specifies annotations to include with the result
*
Next Page Id
string
nextPageId
The id or cookie to use for retrieving the next page of results when paginating through a large result set
 
Page Number
data
pageNumber
The page number to request
1
XML Query
code
/ Required
xmlQuery
An XML query string to use as a Fetch query in Microsoft Dynamics 365

[CRM] Update Attribute

Update an existing CRM Attribute on an Entity | key: updateAttribute

InputDefaultNotesExample
Attribute Body
code
/ Required
attributeBody
Attribute body payload to send
 
Connection
connection
/ Required
connection
 
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70

[CRM] Update Entity

Update a Microsoft Dynamics 365 CRM entity record. | key: updateEntity

InputNotesExample
Connection
connection
/ Required
connection
 
 
Dynamic Values
data
dynamicValues
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Field Value
string
Key Value List
fieldValues
The names of the fields and their values to use when creating/updating a record
 

[CRM] Upsert Entity

Upsert a Microsoft Dynamics 365 CRM entity record. | key: upsertEntity

InputNotesExample
Connection
connection
/ Required
connection
 
 
Dynamic Values
data
dynamicValues
 
 
Entity ID
string
/ Required
entityId
The ID of a specific Entity record
7d577253-3ef0-4a0a-bb7f-8335c2596e70
Entity Type
string
/ Required
entityType
The type of Entity to query, usually a pluralized name
Contacts
Field Value
string
Key Value List
fieldValues
The names of the fields and their values to use when creating/updating a record
 

Raw Request

Send raw HTTP request to Microsoft Dynamics 365 | key: rawRequestV2

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
 
 
Data
string
data
The HTTP body payload to send to the URL.
{"exampleKey": "Example Data"}
Debug Request
boolean
debugRequest
false
Enabling this flag will log out the current request.
 
File Data
string
Key Value List
fileData
File Data to be sent as a multipart form upload.
[{key: "example.txt", value: "My File Contents"}]
Form Data
string
Key Value List
formData
The Form Data to be sent as a multipart form upload.
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header
string
Key Value List
headers
A list of headers to send with the request.
User-Agent: curl/7.64.1
Max Retry Count
string
maxRetries
0
The maximum number of retries to attempt.
 
Method
string
/ Required
method
The HTTP method to use.
 
Query Parameter
string
Key Value List
queryParams
A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.
 
Response Type
string
/ Required
responseType
json
The type of data you expect in the response. You can request json, text, or binary data.
 
Retry On All Errors
boolean
retryAllErrors
false
If true, retries on all erroneous responses regardless of type.
 
Retry Delay (ms)
string
retryDelayMS
0
The delay in milliseconds between retries.
 
Timeout
string
timeout
The maximum time that a client will await a response to its request
2000
URL
string
/ Required
url
Input the path only (/api/data/v9.2/accounts?$select=name), The base URL is already included (https://my-org.api.crm.dynamics.com). For example, to connect to https://my-org.api.crm.dynamics.com/api/data/v9.2/accounts?$select=name, only /api/data/v9.2/accounts?$select=name is entered in this field.
/api/data/v9.2/accounts?$select=name
Use Exponential Backoff
boolean
useExponentialBackoff
false
Specifies whether to use a pre-defined exponential backoff strategy for retries.