Dynamics 365 CRM
Microsoft Dynamics 365 CRM is a cloud-based business application platform that combines components of Customer Relationship Management (CRM) and Enterprise Resource Planning (ERP), along with productivity applications and artificial intelligence tools.
CRM is a category of integrated, data-driven solutions that improve how you interact and do business with your customers. CRM systems and applications are designed to manage and maintain customer relationships, track engagements and sales, and deliver actionable data—all in one place.
CRM tools make the customer facing functions of business easier. They help the user to perform the following tasks:
Centralize customer information
Automate marketing interactions
Provide business intelligence
Facilitate communications
Track sales opportunities
Analyse data
Enable responsive customer service
With the Dynamics 365 CRM connector, you can perform read, create, update, and delete operations on entities, along with create, update, and delete operations on associations. You can execute Dynamics 365 CRM action and function imports.
To use the Dynamics 365 CRM actions, you need to authorize the connector by performing the steps give in the section that follows.
Connector Release Version
Dynamics 365 CRM connector was delivered in the 8.4.1 release.
Supported Actions
Supported Triggers
Supported Authorization
OAuth
* 
Before adding an OAuth connection, ensure that you follow the steps provided in Obtaining Client Id and Client Secrets for Dynamics 365 CRM.
Authorize Dynamics 365 CRM
Dynamics 365 CRM authorization has to be done for each Dynamics 365 CRM connector action. To authorize the Dynamics 365 CRM connector, do the following:
1. In the Authorize Dynamics 365 CRM field, select Add new Dynamics365 login. The Parameters window opens.
2. Enter the following parameters:
Tenant ID—Dynamics 365 CRM tenant id. If you do not have a tenant id, enter common.
Resource URL—Dynamics 365 CRM resource URL
Set Access—The User Impersonation check box is used to execute business logic (code) on behalf of another Dynamics 365 CRM user to provide a desired feature or service using the appropriate role and object-based security of that impersonated user.
3. Click ALLOW.
4. Enter your credentials, and then click Sign in.
5. Rename the Authorization Label, if needed and then click ADD. An authorization is added to the list.
* 
Click TEST to validate the authorization.
Customizing the Dynamics 365 CRM Connector
The following section provides detailed instructions on how to upload customization files. Ensure that you have ThingWorx Flow tools installed on your system to execute the customization steps. The ThingWorx Flow tools are installed automatically with your installation. You need the ThingWorx Administrator login to be able to complete this action. For more information about the ThingWorx Flow tools, see Deploying Connectors.
You can customize the Dynamics 365 CRM Connector in one of the following ways:
Updating OData Metadata—The Dynamics 365 CRM Connector packages version 9.0 of the OData Metadata. You may need to work on a different version or could have added customizations to your version. That will need an update of this file. You can download the packaged version of the Dynamics 365 CRM metadata file for reference and upload your version or an updated version to your ThingWorx Flow instance.
ThingWorx Flow OOTB supports only a few Entities from the Dynamics 365 CRM model. The OOTB settings.json only includes these supported Entities. However, the OData Metadata packaged has all Entities, Associations and anything else that Microsoft supports. You may want to test the Connector for additional Entities and include them in the list of Entities, Properties and Related Items available to the Connector by updating the settings.json file. Then, upload it to your ThingWorx Flow instance. Be careful when editing this file, any syntactical mistake may render the Connector unusable. For understanding how to update this file, download the packaged file and cross-reference with the OData Metadata file in effect.
The following table provides information about the attributes that you can update in the Dynamics 365 CRM connector settings.json file to customize the Dynamics 365 CRM connector:
Attribute
Description
DynamicsApiVersion
Specifies the Dynamics 365 CRM API version. By default, it is set to 9.0.
EntitySetDefinitions
propertyDefinitions
Defines the Dynamics 365 CRM entity sets that you want to display on the ThingWorx Flow UI.
For example: To include the accounts entity set on the UI, under the EntitySetDefinitions attribute, specify the following:
"name": "accounts",
"include": true,
"label": "Account",
where name specifies the Dynamics 365 CRM entity set name.
Set include to true to display the entity set on the UI.
The label attribute defines the entity set name that you want to display on the UI.
Every entity set has properties. Define the properties from an entity set that you want to display on the UI under the propertyDefinitions attribute. You can limit the number of properties from any entity set that you want to display on the UI by providing arrays of the name and label of the property.
For example: To display the accountid property, under the propertyDefinitions attribute of the accounts EntitySetDefinitions attribute, specify the following:
{
"name": "accountid",
"label": "Account ID"
}
where name specifies the property name.
The label attribute defines the property name that you want to display on the UI.
If you want to include all properties of an entity set, then set the value of propertyDefinitions as an empty array, that is, "propertyDefinitions": [].
* 
propertyDefinitions does not apply to the Execute Actions and Execute Functions actions.
relatedItems
If you add a related item, then the entity set data that is returned includes the related items for that particular entity set.
For example: To display the attachments property, under the relatedItems attribute of the accounts EntitySetDefinitions attribute, specify the following:
{
"name": "attachments",
"label": "Attachments"
}
where name specifies the related item name.
The label attribute defines the related item name that you want to display on the UI.
If you do not want to include any related items of an entity set, then set the value of relatedItems as an empty array, that is, relatedItems: [].
Uploading the OData metadata file
1. Download your version of the metadata file by accessing it from your Dynamics 365 CRM instance. For example: https://host.dynamics.com/api/data/v9.0/$metadata. Note that the version number must match your instance version.
Alternately, you can download the version packaged with ThingWorx Flow by running the following command:
flow-deploy settings file-download -t <ThingWorx_Base_URL> -u <ThingWorx_Administrator_Username> -p '<ThingWorx_Administrator_Password>' -f <Path_to_Metadata_XML_File> -s default -c dynamics365 --fileId DynamicsMetadata --contentType application/xml
* 
The value of the fileId parameter must be set to DynamicsMetadata.
2. Open the XML file and ensure that your required customization, if applicable, is present in the downloaded XML file. Edit the file to add your customization, if required.
3. Run the following command to upload the custom OData Metadata file to your ThingWorx Flow instance:
flow-deploy settings file-upload -t <ThingWorx_Base_URL> -u <ThingWorx_Administrator_Username> -p '<ThingWorx_Administrator_Password>' -f <Path_to_Metadata_XML_File> -s default -c dynamics365 --fileId DynamicsMetadata --contentType application/xml
* 
The value of the fileId parameter must be set to DynamicsMetadata.
Uploading the settings.json file
1. Run the following command to download the settings.json file packaged with ThingWorx Flow:
flow-deploy settings download -t <ThingWorx_Base_URL> -u <ThingWorx_Administrator_Username> -p '<ThingWorx_Administrator_Password>' -f <Path_to_Connector_Settings_File> -s default -c dynamics365
2. Edit the settings.json file and ensure that it is compatible with the OData Metadata file you plan to use and you are ready to upload it.
Ensure that the DynamicsApiVersion value in the settings.json file matches with the version in the OData Metadata file that you uploaded earlier.
3. Run the following command to upload the Dynamics 365 CRM connector settings.json file:
flow-deploy settings upload -t <ThingWorx_Base_URL> -u <ThingWorx_Administrator_Username> -p '<ThingWorx_Administrator_Password>' -f <Path_to_Connector_Settings_File> -s default -c dynamics365
After all uploads are successful, restart all ThingWorx Flow services. Your customization is now visible for all Dynamics 365 CRM actions.
Was this helpful?