Connectors

Connecting to Dynamics 365

Data Sync can connect to multiple Dynamics CRM/365 configurations:

  1. Dynamics CRM 2011 (On-premise)
  2. Dynamics CRM 2013 (On-premise)
  3. Dynamics CRM 2015 (On-premise)
  4. Dynamics CRM 2016 (On-premise)
  5. Dynamics 365 On-Premise and Online

Data Sync supports all of these configurations utilising the same connection provider:

To open the connection window click on the 'Connect Data Source' in either the source or destination. This will display the 'Connect to Datasource' window. Choose 'Microsoft Dynamics' and then the 'Microsoft Dynamics CRM' provider.

Connecting to Dynamics 365

To open the connection window click on the 'Connect Data Source' in either the source or destination. This will display the 'Connect to Datasource' window. Choose 'Microsoft Dynamics' and then the 'Microsoft Dynamics 365' provider.

On Premise

Connection Settings

URL:

This is the URL to your Dynamics 365 Organisation Service SOAP\WCF service.

This URL will be similar to: http://crm2016:5555/Org/XRMServices/2011/Organization.svc to get your organisation URL go to Settings->Customizations->Developer Info in Dynamics 365.

Dynamics 365 Developer Info

Authentication Type:
For Active Directory authentication use Managed Domain.

User Credentials: Enter any required credentials. If left blank the current process identity is used.

Entity:
If you have entered the previous information correctly, you should be able to use the Entity drop down menu to select an entity within the Dynamics 365 system.

Save the Connection

Once you have created a connection you will be offered the chance to save it in the connection library. This is a great idea as you can then drag and drop entities and lookups at a later date without creating a new connection. The connection is stored in a file on your local system. To do this click on 'Connect & Create Library Connection', this will open the Connection Library window. Enter in a name and description (optional) for the connection and click OK. This is now saved in the connection tree view.

Save Connection

Setup

Authentication

To connect to Dynamics 365 using Federated Authentication, Microsoft uses a feature called the WIF (Windows Identity Foundation). To enable this feature in Windows 8 and above type the following into a command line:

dism/online/Enable-Feature:Windows-Identity-Foundation

When using windows 7 or windows 2008 server you will need to install WIF runtime from Microsoft.

Properties

CrmAuthenticationProvider

Dynamics 365 authentication provider scheme to use.

OrganisationServiceUrl

URL to your Dynamics 365 Organisation Service SOAP\WCF service.

DateTimeHandling

DataTime handling: Utc or local.

Entity

Entity name.

EntityID

Entity id column name.

FetchXMLFilterExpression

Filter expression to add to the generated FetchXML to filter the records.

OnErrorOutputRequestDetails

Output the request data to the log.

PageSize

Number of records to return from CRM in each request, maximum 5000.

ThreadCount

Maximum parallel requests sent to CRM server.

Timeout

Service HTTP Request Timeout.

UpdateBatchSize

Number of updates to send to server in each request.

Custom Connections

Please see below for a list of functions that can be used with the Dynamics 365 Provider in Project Automation or Dynamic Columns.

ExecuteOrganisationRequest

Execute any request on the OrganizationService.

DataSourceB.ExecuteOrganizationRequest(request);

ExecuteWorkflowRequest

To call a workflow you can use the ExecuteWorkflowRequest wrapper. To have it run once the data has been changed add it to the AfterAddItem() method within Item Events.

DataSourceB.ExecuteWorkflowRequest(new Microsoft.Crm.Sdk.Messages.ExecuteWorkflowRequest() { WorkflowId = Guid.NewGuid() });

GetOptionSet

DataSourceB.GetOptionSet(string entityName, string attributeName)

GetProxy

To get an instance of the OrganizationService directly you can use:

DataSourceB.Connection.GetProxy()

Or if you are doing it from Dynamic Columns you need a cast to the connector type:

GetDataSourceB().Connection.GetProxy()

SetState

Call within Project Automation Item Events to set the state flags.

DataSourceB.SetState(item.ToDataCompareItem(), int StateCode, int StatusCode)

SetOwner

Call within Project Automation Item Events to set the owner flags.

DataSourceB.SetOwner(item.ToDataCompareItem(), Guid id, type)

type can be either systemuser or team.

GetEntityLastChanged

Get the value of when the entity was last changed.

 DataSourceB.GetEntityLastChanged(string entityName, string filter)

GetFetchFilterXmlForModifiedSince

DataSourceB.GetFetchFilterXmlForModifiedSince(DateTime)

UpdateSourceRow

Use this to update your source after a synchronisation has occurred. For example; return a state flag to mark the record as sent. Or update an ID column, so that the value matches that in Dynamics.

DataSourceB.UpdateSourceRow(AttributeCollection<string,object> properties, Guid id)