Click here to Skip to main content
13,556,249 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


9 bookmarked
Posted 5 Feb 2009
Licenced CPOL

BizTalk Server 2006 Adapter for MS CRM 3.0

, 5 Feb 2009
Rate this:
Please Sign up or sign in to vote.
The articles describes how to use and leverage MS CRM adapter to integrate CRM system with BizTalk.


BizTalk communicates with the outer world using adapters, which helps to speed up the implementation process for IT infrastructure. Adapters perform whatever communication semantics or protocol is required by the remote system. Adapters do not perform any conversion or translation and they just bring the bits into the BizTalk system. Microsoft has developed Dynamics CRM system, which caters to the need for effective CRM system. Major function of CRM system is to focus on customer and front office to provide value added services to them. It helps them maximize their ROI, leads to greater customer satisfaction, ensures higher revenue leading to healthy bottom line. As CRM becomes strategic, it must encompass lot more functional areas within enterprise. Inline to this high integration needs is generated which means CRM must integrate with an even larger number of systems. Microsoft BizTalk CRM adapter caters to the same need. We will discuss integration solution provided with Dynamics CRM to integrate it with other business applications using Microsoft BizTalk Server CRM Adapter.We will run you through all aspects of Microsoft BizTalk Dynamics CRM adapter starting from why Integration is needed, Basics of CRM, Adaptor installation and configuration, CRM development SDK and few out of the box items as well.

Integration Solutions for Dynamics CRM

Microsoft Dynamics, e.g., Great Plains caters to the need for managing receivables, inventory and finance and other functionalities. The Dynamics CRM is used to manage relationship with customers, cross-sales and up-sales. Thus, integration between Dynamics CRM and ERP system as Dynamics Great Plains is required which should cater to the need of Information availability in real time, data consistency and Business Process Collaboration between two separate business applications. Following integration solutions will be available with Dynamics CRM:

Web Services

Dynamics CRM provides web services framework to get the data in and out from BizTalk. You can extend the same using the rich SDK provided by the Dynamics CRM allowing doing server and client side programming which helps developers to write integration modules to integrate Dynamics CRM with the web pages. Please refer to the link below for web services:

Real-Time Integration Framework

Microsoft provides RTIF framework, so that Dynamics ERP systems and Dynamics CRM should talk to each other. This integrates Microsoft Dynamics CRM with other Microsoft Dynamics ERP’s (Dynamics GP, Dynamics Ax, and Dynamics Nav). For product details, please refer:

BizTalk Server 2006 Adapter for Dynamics CRM

Using BizTalk Server 2006 Adapter for Dynamics CRM, you will be able to integrate any kind of integration between business applications, but we recommend it for ensuring business process collaboration between business applications. So using it you will be able to integrate your ERP like SAP with Dynamics CRM. It will be taking more dev cost to write your own code for doing link management if you choose this solution for integration ensuring data consistency. You can use it if you want B2B or EAI integration between Dynamics CRM and your non-Microsoft ERP.

Basics of CRM System

CRM system is divided into multiple sub-systems such Sales, Marketing, and Service, etc. Each of these sub-systems maintains a range of information like “Service” sub-system maintains Cases (customer escalations), Accounts, Contacts, and Products, etc. These sub systems have association/relationship among themselves. Each of these entities follows a schema, which contains their type information. Thus, while working with CRM, we deal with these entities and attributes. Custom entities also are created if needed. We create, update or delete instances of these entities. In order to understand CRM entities, their schema, relationship with other entities etc, go to “Settings >> Customization >> Customize Entities”. You will see the list of entities available in CRM system. List shows name, schema name, type and description. You can create your own new custom entity or modify existing entity. Double clicking of an existing entry shows you details of attributes, forms/views to populate these entities in CRM system and relationships. When you check “Attributes” of entity, you will see attribute schema name, display name, type and description. Attribute schema name and type is very important information because BizTalk CRM adapter generates schema based on schema name and type information inside CRM system.

Installing and Configuring BizTalk CRM Adapter

Following are the key points of installation and usage guide:

  1. Installation is simple and setup based. For this, please download the .msi file.
  2. You also need to read Installation provided with the adapter which talks about the scenario where your BizTalk host service account is different from CRM system account. In case your Host account does not have access on CRM system, then you need to create a new host with account which has proper access to CRM. After that, you create a send handler under the CRM host created under BizTalk and then related ports should be created under the new handler. Please refer to the installation guide for more details.
  3. Installation guide also talks about creating port and generating schema for actions and entities. Please do have a look at them.
  4. Installation of MS Dynamics CRM SDK 3.0 is recommended, which holds good amount of code samples and information.

How to Perform Operation using BizTalk CRM Adapter

As mentioned earlier, Dynamics CRM Adapter uses web services for integration. This adapter is Solicit-Response adapter. You can perform basic operations with BizTalk CRM adapter such as Query Data, Create Data, Update Data, Delete Data, Execute Operations, and Retrieve Data, etc. and complex operations like Pick List, Lookup and custom entities/attributes. These operations can be found under Microsoft Dynamics CRM actions node of the Add Adapter Wizard. Generally, you will find web service URL as:

The depicted diagram above shows a scenario where an entity is generated using CRM adapter for BizTalk and the response of CRM is saved in a XML file. For integration with CRM below, information like URL, Domain, User, Code and, if required proxy, should be ready.

Below is the discussion about the various operations performed on CRM System.

Query on CRM system is fetching XML and returning results. Please make sure that web service URL has been put as http://<CRM-Server>/mscrmservices/2006 and not like http://<CRM-Server>/MSCRMServices/2006/CrmService.asmx as we need to supply URL for web service virtual directory. While generating schema using “Add Generated Items” from “Add Adapter Metadata” Option when prompted for user name and password, make sure that user name and password should have adequate access to fetch entity and their schema information from CRM system. Select entities which you need to deal with. For query, you need to set action as “Execute Fetch”. Out of several schemas created, you should only be interested in request and response. “ExecuteFetch_ExecuteFetchRequest.xsd” serves purpose of request schema. For response schema, you need to use Response.xsd located @ “C:\Program Files\BizTalkAdapter\Schemas\. While creating XML request, set crm_action attribute value accordingly to “execute”. Create data with CRM Adapter allows you to create entity like account, contact, case, products, etc. in CRM system. Apart from performing the above steps, you need to check, e.g., pick list and lookup type attributes, required fields and relationship among the entities. Now while creating XML request, set “crm_action’’ attribute to “create”. Few words about setting “crm_action” attribute. When performing create operation, it is always safe and good to provide “create” as value in “crm_action” attribute. However, if “crm_action” value is not provided, then it uses the following logic to take a decision.

  • If the primary key node of the entity (in this case contactid) is not present in the XML or if the node has an empty value, the adapter assumes this is a “create” action.
  • If the primary key node of the entity has a correct GUID value, the adapter assumes the action to be “update”.

B using delete operation, you can delete instance of one of the entity. It is always recommended to check dependent activities and come with logic to handle them when performing delete operation. Rest of the things are similar to those discussed in the querying section.

Update” operation is almost similar to “Create” operation. When posting entities data using the generated schema, you need to know whether this entity already exists in CRM. You can create a .NET assembly, which, via the CRM web service, performs the same query. This has the advantage of being able to be called through a BizTalk Expression shape or through. Once it already exists, you can get its GUID primary key and set it on the appropriate node of the message, which you will pass to the adapter. Now you just need to send values of those attributes only which you wish to update.

The last and not the least are the operations related to PickList and Look Up. In CRM, you will have two types of "lookups".

  • Pick Lists: This is a string value with an integer primary key which is added during the customization. Pick lists exist only for a particular entity type. “Picklist” is similar to options/combo control where user can select a value from existing set of values. For example, “Address Type” field of account entity is “PickList” type with option values as “Bill To”, “Ship To”, “Primary” and “Other”. PickList type fields can be displayed as combo box or radio buttons on entity form.
  • Lookups: They are foreign key links, which exist between entities. They comprise of a GUID primary key and any custom attributes which have been added during the design of the entity. “Lookup” field is used to link two entities together. For example, when we create an account, we link account entity instance to a contact entity instance where contact is primary contact person for account. In this case, “lookup” type field is used to link account and contact entities. When you see account entity details and screen, you will find “Primary Contact” field as “Lookup” type.

You need to create a standard .NET assembly which would call into the CRM web service and retrieve the data for me. Then call this assembly from inside a BizTalk map using a Scripting function and pass in various values in order to determine what pick list / lookup type to evaluate against. This has the benefit of allowing me to perform these "lookup" resolutions from within the map, allowing the full source message to be mapped to the CRM message in a single Transformation shape. Depending on whether you are resolving Pick Lists or Lookups will determine which web service you call and what result you get back. To query (and cache) Pick Lists, you need to call into the MetaDataService web service, while you call the CrmService web service to resolve Lookups.


The BizTalk MS CRM 3.0 adapter in BizTalk Server brings the flexibility of MS CRM communications to the different systems using BizTalk Server messaging. The CRM adapters make it possible to define send ports that have a wide-range of operations. The combine use of CRM adapter with CRM web services make it easy to integrate with the rest of your application. The CRM adapter provides a rich feature set, easily accessible and configurable dialog boxes. They provide numerous options around messages, MS Dynamics CRM entities, MS Dynamics CRM entities and security, error handling and Logging, which open new doors to new distributed integration scenarios that make it easy with BizTalk. The CRM adapter marks an important milestone for BizTalk Server, one of maturity in today’s service-oriented landscape. As the product continues to evolve in the years ahead, you are likely to see even deeper integration between MS CRM systems and the BizTalk Server product.


  • 5th February, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Architect XXXX
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180515.1 | Last Updated 5 Feb 2009
Article Copyright 2009 by tiwarivishnu
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid