Microsoft Dynamics 365 Component

Query, create, update or delete Microsoft Dynamics 365 API records
Component key: ms-dynamics#
DescriptionMicrosoft 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.
#
Microsoft Dynamics 365 Connections#
MS Dynamics OAuth 2.0 Client CredentialsThe 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:
- Create an "App" in Azure
- Create an "Application User" in Dynamics
#
Create an app in Microsoft Azure- Log in to Azure Portal
- Select App registrations
- Click + New registration
- Supported account types can be Single tenant
- No Redirect URI is necessary
- Click Register
- Under API permissions click +Add a permission
- Select Dynamics CRM
- Check the
user_impersonation
permission - Click Add permissions
- Under API permissions click Grant admin concent for (your org)
- 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.
- Returning to the Overview page, take note of Application (client) ID
- 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- Log in to Power Platform admin center
- Select Environments and choose your Dynamics Environments
- Select S2S Apps
- 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 PrismaticWithin 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
- Enter that Dynamics URL as the Web API URL. It should look like
Input | Notes | Example |
---|---|---|
Input Client ID string / Required clientId | Notes Generated when you register an app in Azure portal | Example |
Input Client secret value password / Required clientSecret | Notes Generated when you register an app in Azure portal | Example |
Input Scopes string / Required scopes | Notes This should be your Dynamics URL with '/.default' appened to it | Example https://REPLACE-ME.api.crm.dynamics.com/.default |
Input Token URL string / Required tokenUrl | Notes This can be found by visiting your app in Azure portal and selecting 'Endpoints' | Example https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token |
Input Web API URL string / Required webApiUrl | Notes Your organization's Microsoft Dynamics 365 Web API URL. | Example https://REPLACE-ME.api.crm.dynamics.com/ |
#
MS Dynamics OAuth 2.0 Auth CodeThe OAuth 2.0 auth code flow allows your user grant permission to your integration to interact with Dynamics on their behalf.
- Log in to Azure Portal
- Select App registrations
- Click + New registration
- Supported account types can be Single tenant
- Under Redirect URI enter https://oauth2.prismatic.io/callback
- Click Register
- Under API permissions click +Add a permission
- Select Dynamics CRM
- Check the
user_impersonation
permission - Click Add permissions
- 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.
- 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
- Enter that Dynamics URL as the Web API URL. It should look like
Input | Default | Notes | Example |
---|---|---|---|
Input Authorize URL string / Required Hidden Field authorizeUrl | Default https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize | Notes The OAuth 2.0 Authorization URL for Microsoft Dynamics 365. | Example |
Input Client ID string / Required clientId | Default | Notes | Example |
Input Client Secret password / Required clientSecret | Default | Notes | Example |
Input Scopes string scopes | Default | Notes A space-delimited set of one or more scopes to get the user's permission to access. | Example https://REPLACE-ME.crm.dynamics.com/user_impersonation offline_access |
Input Token URL string / Required Hidden Field tokenUrl | Default https://login.microsoftonline.com/organizations/oauth2/v2.0/token | Notes The OAuth 2.0 Token URL for Microsoft Dynamics 365. | Example |
Input Web API URL string / Required webApiUrl | Default | Notes Your organization's Microsoft Dynamics 365 Web API URL. | Example https://my-org.api.crm.dynamics.com/ |
#
Data Sources#
[CRM] Entity Object SelectionA subset of Dynamics CRM Entity Types. | key: getEntitiesMetaData | type: objectSelection
Input | Default | Notes |
---|---|---|
Input Connection connection / Required connection | Default | Notes |
Input Default Selected Entity Types string Value List defaultSelectedRecordTypes | Default | Notes The names of the Entity Types to default in a selected state. |
Input Include All Custom Entity Types boolean / Required includeAllCustomRecordTypes | Default | Notes When true, will include all Custom Entity Types, even those not included in Record Type Name Filter. |
Input Include Only Top Level Record Types boolean / Required includeOnlyTopLevelRecordTypes | Default | Notes When true, will include only Entity Types that are top-level, meaning not subtypes of other Types, regardless of other filters. |
Input Entity Type Filter string Value List recordTypeFilter | Default | Notes The names or labels of the Entity Types to include; if blank then all types are included. Uses case-insensitive matching. |
#
Actions#
[CRM] Create AttributeCreate a CRM Attribute on an Entity | key: createAttribute
Input | Default | Notes | Example |
---|---|---|---|
Input Attribute Body code / Required attributeBody | Default
| Notes Attribute body payload to send | Example |
Input Connection connection / Required connection | Default | Notes | Example |
Input Entity ID string / Required entityId | Default | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
#
[CRM] Create EntityCreate a new Microsoft Dynamics 365 CRM entity record. | key: createEntity
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Dynamic Values data dynamicValues | Notes | Example |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Field Value string Key Value List fieldValues | Notes The names of the fields and their values to use when creating/updating a record | Example |
#
[CRM] Delete EntityDelete the specified Microsoft Dynamics 365 CRM entity record. | key: deleteEntity
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
#
[CRM] Get AttributeRetrieve a single CRM Attribute | key: getAttribute
Input | Notes | Example |
---|---|---|
Input Attribute Type string / Required attributeType | Notes The type of Attribute to query | Example |
Input Connection connection / Required connection | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Expand Property Name string Value List expandPropertyNames | Notes The names of entity properties to linked entities that should be included | Example |
Input Field Name string / Required Value List fieldNames | Notes The names of the fields to retrieve | Example |
#
[CRM] Get Current UserGet information about the currently logged in CRM user | key: getCurrentUser
Input | Notes |
---|---|
Input Connection connection / Required connection | Notes |
#
Output Example Payload{ "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 MetadataA subset of Dynamics CRM Entity Types. | key: getEntitiesMetaData
Input | Default | Notes |
---|---|---|
Input Connection connection / Required connection | Default | Notes |
Input Default Selected Entity Types string Value List defaultSelectedRecordTypes | Default | Notes The names of the Entity Types to default in a selected state. |
Input Include All Custom Entity Types boolean / Required includeAllCustomRecordTypes | Default | Notes When true, will include all Custom Entity Types, even those not included in Record Type Name Filter. |
Input Include Only Top Level Record Types boolean / Required includeOnlyTopLevelRecordTypes | Default | Notes When true, will include only Entity Types that are top-level, meaning not subtypes of other Types, regardless of other filters. |
Input Entity Type Filter string Value List recordTypeFilter | Default | Notes The names or labels of the Entity Types to include; if blank then all types are included. Uses case-insensitive matching. |
#
[CRM] Get EntityRetrieve a single Microsoft Dynamics 365 CRM entity record. | key: getEntity
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Expand Property Name string Value List expandPropertyNames | Notes The names of entity properties to linked entities that should be included | Example |
Input Field Name string / Required Value List fieldNames | Notes The names of the fields to retrieve | Example |
#
[CRM] Get Entity MetadataGet definition of Microsoft Dynamics 365 CRM entity records that satisfy the filter expression. | key: getEntityMetaData
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Entity Type string / Required entityType | Default | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Use Logical Name for Lookup boolean / Required lookupField | Default | Notes | Example |
#
[CRM] Query AttributesQuery for CRM Attributes that satisfy the filter expression | key: queryAttributes
Input | Notes | Example |
---|---|---|
Input Attribute Type string / Required attributeType | Notes The type of Attribute to query | Example |
Input Connection connection / Required connection | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Expand Property Name string Value List expandPropertyNames | Notes The names of entity properties to linked entities that should be included | Example |
Input Field Name string / Required Value List fieldNames | Notes The names of the fields to retrieve | Example |
Input Filter Expression string filterExpression | Notes The filter expression that used for querying entity collections | Example Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS' |
#
[CRM] Query EntitiesQuery for Microsoft Dynamics 365 CRM entity records that satisfy the filter expression. | key: queryEntities
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Entity Type string / Required entityType | Default | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Expand Property Name string Value List expandPropertyNames | Default | Notes The names of entity properties to linked entities that should be included | Example |
Input Field Name string / Required Value List fieldNames | Default | Notes The names of the fields to retrieve | Example |
Input Filter Expression string filterExpression | Default | Notes The filter expression that used for querying entity collections | Example Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS' |
Input Next Page Id string nextPageId | Default | Notes The id or cookie to use for retrieving the next page of results when paginating through a large result set | Example |
Input Order By Field Name string Value List orderByFieldNames | Default | Notes The names of the fields to order by | Example |
Input Records Per Page data / Required recordsPerPage | Default 100 | Notes The number of record to retrieve per page | Example 100 |
#
[CRM] Raw RequestSend a raw request to Microsoft Dynamics 365 CRM | key: rawRequest
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Data string data | Default | Notes The HTTP body payload to send to the URL. | Example {"exampleKey": "Example Data"} |
Input Debug Request boolean debugRequest | Default false | Notes Enabling this flag will log out the current request. | Example |
Input File Data string Key Value List fileData | Default | Notes File Data to be sent as a multipart form upload. | Example [{key: "example.txt", value: "My File Contents"}] |
Input Form Data string Key Value List formData | Default | Notes The Form Data to be sent as a multipart form upload. | Example [{"key": "Example Key", "value": new Buffer("Hello World")}] |
Input Header string Key Value List headers | Default | Notes A list of headers to send with the request. | Example User-Agent: curl/7.64.1 |
Input Max Retry Count string maxRetries | Default 0 | Notes The maximum number of retries to attempt. | Example |
Input Method string / Required method | Default | Notes The HTTP method to use. | Example |
Input Query Parameter string Key Value List queryParams | Default | Notes 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. | Example |
Input Response Type string / Required responseType | Default json | Notes The type of data you expect in the response. You can request json, text, or binary data. | Example |
Input Retry On All Errors boolean retryAllErrors | Default false | Notes If true, retries on all erroneous responses regardless of type. | Example |
Input Retry Delay (ms) string retryDelayMS | Default 0 | Notes The delay in milliseconds between retries. | Example |
Input Timeout string timeout | Default | Notes The maximum time that a client will await a response to its request | Example 2000 |
Input URL string / Required url | Default | Notes This is the URL to call. | Example /accounts?$select=name |
Input Use Exponential Backoff boolean useExponentialBackoff | Default false | Notes Specifies whether to use a pre-defined exponential backoff strategy for retries. | Example |
#
[CRM] Run Fetch XML QueryExecute a fetch XML query against your Microsoft Dynamics 365 CRM instance. | key: fetchXml
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Impersonate User Id string impersonateUserId | Notes Specifies the GUID of a user to impersonate when executing the query | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Include Annotations string includeAnnotations | Notes Specifies annotations to include with the result | Example * |
Input Next Page Id string nextPageId | Notes The id or cookie to use for retrieving the next page of results when paginating through a large result set | Example |
Input Page Number data pageNumber | Notes The page number to request | Example 1 |
Input XML Query code / Required xmlQuery | Notes An XML query string to use as a Fetch query in Microsoft Dynamics 365 | Example
|
#
[CRM] Update AttributeUpdate an existing CRM Attribute on an Entity | key: updateAttribute
Input | Default | Notes | Example |
---|---|---|---|
Input Attribute Body code / Required attributeBody | Default
| Notes Attribute body payload to send | Example |
Input Connection connection / Required connection | Default | Notes | Example |
Input Entity ID string / Required entityId | Default | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
#
[CRM] Update EntityUpdate a Microsoft Dynamics 365 CRM entity record. | key: updateEntity
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Dynamic Values data dynamicValues | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Field Value string Key Value List fieldValues | Notes The names of the fields and their values to use when creating/updating a record | Example |
#
[CRM] Upsert EntityUpsert a Microsoft Dynamics 365 CRM entity record. | key: upsertEntity
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Dynamic Values data dynamicValues | Notes | Example |
Input Entity ID string / Required entityId | Notes The ID of a specific Entity record | Example 7d577253-3ef0-4a0a-bb7f-8335c2596e70 |
Input Entity Type string / Required entityType | Notes The type of Entity to query, usually a pluralized name | Example Contacts |
Input Field Value string Key Value List fieldValues | Notes The names of the fields and their values to use when creating/updating a record | Example |
#
Raw RequestSend a raw request to any Microsoft Dynamics 365 service | key: rawRequestV2
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Data string data | Default | Notes The HTTP body payload to send to the URL. | Example {"exampleKey": "Example Data"} |
Input Debug Request boolean debugRequest | Default false | Notes Enabling this flag will log out the current request. | Example |
Input File Data string Key Value List fileData | Default | Notes File Data to be sent as a multipart form upload. | Example [{key: "example.txt", value: "My File Contents"}] |
Input Form Data string Key Value List formData | Default | Notes The Form Data to be sent as a multipart form upload. | Example [{"key": "Example Key", "value": new Buffer("Hello World")}] |
Input Header string Key Value List headers | Default | Notes A list of headers to send with the request. | Example User-Agent: curl/7.64.1 |
Input Max Retry Count string maxRetries | Default 0 | Notes The maximum number of retries to attempt. | Example |
Input Method string / Required method | Default | Notes The HTTP method to use. | Example |
Input Query Parameter string Key Value List queryParams | Default | Notes 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. | Example |
Input Response Type string / Required responseType | Default json | Notes The type of data you expect in the response. You can request json, text, or binary data. | Example |
Input Retry On All Errors boolean retryAllErrors | Default false | Notes If true, retries on all erroneous responses regardless of type. | Example |
Input Retry Delay (ms) string retryDelayMS | Default 0 | Notes The delay in milliseconds between retries. | Example |
Input Timeout string timeout | Default | Notes The maximum time that a client will await a response to its request | Example 2000 |
Input URL string / Required url | Default | Notes /api/data/v9.2/ for Dynamics CRM or /data/ for other Dynamics products | Example /api/data/v9.2/accounts?$select=name |
Input Use Exponential Backoff boolean useExponentialBackoff | Default false | Notes Specifies whether to use a pre-defined exponential backoff strategy for retries. | Example |