Connecting to Dynamics CRM

Dynamics CRM is a widely used cloud CRM from Microsoft focused on Sales, Marketing, and Service (help desk) sectors. Skyvia supports importing data to and from Dynamics CRM, exporting Dynamics CRM data to CSV files, replicating Dynamics CRM data to relational databases, and synchronizing Dynamics CRM data with other cloud CRMs and relational databases.

Dynamics CRM-Specific Features and Limitations

When performing replication with incremental updates and synchronization, Skyvia removes records deleted in Dynamics CRM in another source only if auditing for such replicated/synchronized entities is enabled in Dynamics CRM. To start auditing, click Settings in the Dynamics 365 Navigation Pane. Then under System, click Auditing. In the Audit area, click Global Audit Settings. After this, in the System Settings dialog box, click the Auditing tab. Then select the Start Auditing check box. For more information about Dynamics 365 auditing, check the CRM Book or Dynamics 365 documentation.

When the not equals operator is used in filters for Dynamics CRM, records with an empty (null) value in the compared field are also returned. This behavior is different from the behavior of this operator for database, but this is the normal Dynamics CRM behavior.

Dynamics CRM object can have a reference field that can reference different object types. For example, the Contact object has the parentcustomerid field, which can reference another contact object or an account object. For such fields, Skyvia displays an additional field with the name of the reference field with suffix ‘$type’ added. For the parentcustomerid field it would be parentcustomerid$type. When loading/exporting data from Dynamics CRM, this field value will be a name of the referenced object type. When loading data to Dynamics CRM, this field determines the type of the referenced object. If the reference field is a required field, this virtual field is also required.

Note that Skyvia does not support such polymorphic relations between objects. It means that when you export an object, the fields of related objects that are referenced by such fields cannot be added to export. And you cannot add related objects that are referenced by such a field when performing one-to-many import or synchronization.

Additionally there is a limitation on restoring such relations from Backup. Skyvia can correctly restore such relations only when the reference field is not required and is updatable.

When backing up the Dynamics CRM connections object, you need to pay attention to the following: when creating a record in the connections object, two records for both directions are actually created. This means that when records are restored from backup, duplicates may be created. In order to avoid creating duplicates when restoring connections, restore only the records with IsMaster=True. Actually, you may back up only the records with IsMaster=True for this table. For this, when creating a backup package, after selecting the connections table, click the edit link and specify the corresponding filter condition.

Dynamics CRM Connections

When creating a Dynamics CRM connection, first, you need to specify the name for your connection and the URL that you use to connect to Dynamics CRM (usually it looks like: ).

Then you need to select the Authentication kind to use. Skyvia supports User Name & Password and OAuth 2.0 authentication.

OAuth 2.0 Connections

If you don’t want to store your username and password on Skyvia, you can create an OAuth 2.0 connection, where you authenticate directly in Dynamics CRM, and don’t specify your credentials on Skyvia.

To create an OAuth 2.0 connection, perform the following steps:

  1. Click the Sign In with Dynamics CRM button.
  2. Pick a Dynamics CRM account if you are already signed in or sign in to Dynamics CRM.

    Sign in to Dynamics CRM

  3. Review the list of required permissions, select the Consent on behalf of your organization check box, and click Accept.

    Sign in to Dynamics CRM - privileges

User Name & Password Connections

To use User Name & Password authentication, you need to specify the user name (Windows Live ID), and password for your Windows Live ID account.

Connection Editor window

Additional Parameters

Metadata Cache — this parameter determines for how long the cached metadata for the connection are considered valid. By default, Skyvia caches metadata of available objects in cloud sources. Whenever necessary, you can reset metadata cache for a connection manually in the Connection Editor by clicking the Clear Cache button. Read Metadata Cache for more information. The following values are available for this parameter:

  • Disabled — metadata cache is not created; metadata are queried automatically whenever required.
  • One Hour — metadata cache expires one hour after the last refresh.
  • One Day — metadata cache expires one day after the last refresh.
  • One Week — metadata cache expires one week after the last refresh.
  • One Month — metadata cache expires one month after the last refresh.
  • Infinite — cache never expires/resets automatically. Default value.

If necessary, you may click Advanced Settings and set additional connection parameters:

Batch Size — this parameter specifies the max number of records to send to Dynamics CRM in one batch. Default value is 500, and usually you don’t need to change this setting. Max possible value, supported by Dynamics CRM is 1000. However, Dynamics CRM may need time to process records depending on the number of fields in a record, triggers, etc. It can be configured to timeout after the specified period of time. In this case the connection may freeze and package execution may fail after it. If you experience timeout errors when loading data to Dynamics CRM, decrease the Batch Size parameter value. You may try, for example, a value 50.