Connectors

Connecting to Dynamics 365

As Microsoft are disabling username and password authentication we have re worked the Dynamics connector to make connecting via OAuth easier and the default connection type.

The following documentation relates to version 3.0.2076 and above.

To get started you simply paste the URL to your Dynamics 365 site into the URL field and Data Sync will fill in the rest of the URL to match what is needed.

To move between the authentication types just expand the drop down list and select the type you need from the list.

Dynamics Authentication Options

For connecting to Dynamics 365 we have made a public application in our Azure AD so that Data Sync can request the required permissions from your Dynamics site. This is the default Authentication type and makes for a quick authentication process.

If you want to create your own private app for connecting via OAuth then we have listed the details you need here.

If your site still has the legacy Username and Password authentication enabled then you can use your Office 365 credentials. The documentation for connecting with these can be seen here.

Alternatively the documentation for On-Premise Dynamics can be seen here.

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

Save to Connection Library

Authentication

To connect to Dynamics 365 using a Username & Password, 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

Below is a list of the properties you can set once you have connected to Dynamics.

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)