Integrating with Microsoft Dynamics CRM Online

This article details how to integrate your Dynamicweb solution with Microsoft Dynamics CRM Online, so that users are imported from CRM Online to your Dynamicweb solution.

This involves:

  • Downloading the CRM integration files and placing them in the correct folders
  • Creating a Data Integration activity
  • Creating and scheduling an import activity
  • Extending the integration with columns matching your data

Here’s how.

First you must download and copy the relevant files to your solution:

  1. Download the CRM Online Integration zip and extract it
  2. Copy the CrmIntegration.dll and the Microsoft.Xrm.Sdk.dll to the Dynamicweb bin folder
  3. Copy the integration activity template file - CrmUserImport.xml - to the Files/System/Integration/Jobs folder

You can now create a Data Integration activity from the template, so let’s do that.

To create the data integration activity:

  • Go to Settings > Integration > Data Integration
  • Click New activity from template
  • Select the CrmUserImport template (the one you copied to Files/System/Integration/Jobs)
  • Name it
  • Click OK (you may have to wait a bit)

A new data integration activity has now been created – and you can schedule a batch integration task to run it at appropriate intervals. 

To create a scheduled task executing the import activity:

  1. Go to Settings-> Integration->  Integration Framework Batch
  2. Click Add to create a new scheduled activity (Figure 4.1)
Figure 4.1 Configuring the import activity

Configure the activity as in the screenshot above:

  1. Select the CRM Addin type
  2. Provide the CRM web service URL – in the format https://yourwebsite.com/XRMServices/2011/Organization.svc
  3. Leave the Domain empty if you use a live web CRM – but if you’re on a local network CRM, provide a domain and a password
  4. In the Contact columns field provide a comma separated string of the columns you want to retrieve from CRM Online, e.g. contactid,donotbulkpostalmail,ownerid,parentcustomerid,communityaccess,emailaddress1,firstname,lastname,new_username,new_password,jobtitle,address1_country,address1_city,address1_postalcode,address1 telephone1 - but this is entirely dependent on your CRM Online data
  5. Under Users Import Activity select the data integration activity you created during the previous step
  6. Select a destination group to add the imported users to

Of course, you also need to name the activity, and set a start time and an interval at which to repeat it.

In principle, you can now run the scheduled task and import your users – but in practice you must extend the integration to fit your CRM Online data.

The integration activity template provided by us – CrmUserImport.xml – contains a default set of columns to retrieve from CRM Online – but you can (and probably should) add and remove columns from the job file to customize the integration.

To add a new column to the import:

  • Add desired columns system names to the Scheduled task “Contact columns” list
  • Open the data integration template (Files/System/Integration/Jobs) and edit the xml in a file editor of your choice

Add the columns to the Source > Schema > Table > Columns section in the following format:

XML
<column type="Dynamicweb.DataIntegration.Integration.Column"> <name>contactcolumnname</name> <type>System.String</type> <isNew>False</isNew> <isPrimaryKey>False</isPrimaryKey> </column>
  • Open the corresponding integration activity in Data Integration
  • Add new mappings from Source – the CRM columns you just added – to Destination (AccessUser columns in the Dynamicweb database)
  • Save the job

Run the scheduled task and verify that the result is as expected. Logs can be found in /Files/System/Log/ScheduledTasks and in /Files/System/Log/DataIntegration.