Before you begin make sure that you installed the Microsoft BizTalk Adapter pack!
The first step to create an account in Microsoft Dynamics CRM’ is create a new application in the Administration console. You can name the project “CRM_create_account”.
The next step is to create a ‘static solicit-Response Send port’.
Choose a name for your port like: ‘Send_receive_CRM’
Select a Type: ‘Microsoft dynamics CRM’
Choose this Sendhandler: ‘BizTalk Server application’
Send pipeline: XML transmit
Receive pipeline: XML receive
And click to configure:
The web service URL is the URL of where the CRM system could be found.
In our application we changed the default localhost for ‘10.217.33.115’. You need to fill in your IP address of your CRM system. Add ‘mscrmservices/2006’ behind your IP-address and you are set to go!
The whole Web service URL will look like this: http://l0.217.33.115/mscrmservices/2006
To check if you’ve got the right IP you can open this IP in a browser.
http://10.217.33.115/mscrmservices/2006/crmservice.asmx
Note: it might be necessary to put a port behind the IP-address. On our test system we had to make the URL (for port ‘5555’) like this:
http://10.217.33.115:5555/mscrmservices/2006
Start a new BizTalk project in Microsoft visual studio.
Go to add/ add generated Items and select ‘Add adapter meta’ data and press Add.
Select Microsoft Dynamics CRM as adapter, select your SQL server, the BizTalkMgmtDb database and select your port (which you made in the first step)
And press next
Fill in your user name and password
You have to give your user name with the domain in front.
In our case the user name was: d30\adm_fereem
We want to create an account so, we select under Microsoft Dynamics CRM Entities: Account
We want to create an account so, we select under Microsoft Dynamics CRM Entities: Account
The adapter creates the necessary schemas to add an account and an Orchestration.
Select a strong name key file and give the application an application name:
“CRM_create_account” (the same as in the first step). Make sure that the solution will deploy the project.
The response of entities is always in the same schema. This schema is not created but you can find this schema at:
C:\Program Files\Microsoft BizTalk Adapter Pack\Schemas
And then the ‘Response.xsd’.
Include this schema into the project.
Open the orchestration and select at the multi-part message types/accountRequest/Parameters
The type of this parameter is the account_entities schema that that has just been created.
- Create an input message, with the account_entities schema.
- Create an account entities message, with the multi-part message type schema
- Create an output message, with the just included Response schema.
Select a strong name key file and give the application an application name:
“CRM_create_account” (the same as in the first step). Make sure that the solution will deploy the project.
The response of entities is always in the same schema. This schema is not created but you can find this schema at:
C:\Program Files\Microsoft BizTalk Adapter Pack\Schemas
And then the ‘Response.xsd’.
Include this schema into the project.
Open the orchestration and select at the multi-part message types/accountRequest/Parameters
The type of this parameter is the account_entities schema that that has just been created.
- Create an input message, with the account_entities schema.
- Create an account entities message, with the multi-part message type schema
- Create an output message, with the just included Response schema.
That’s all we need, let's build the orchestration!
Connect the nodes to the messages:
-Receive input = Msg_input
-Send accountentities = Msg_accountentities
-Receive output = Msg_output
-Send output = Msg_output
Create a receive port, to receive the input file, and transform this message to Msg_accountEntities.
-Receive input = Msg_input
-Send accountentities = Msg_accountentities
-Receive output = Msg_output
-Send output = Msg_output
Create a receive port, to receive the input file, and transform this message to Msg_accountEntities.
Next send this message to a CRM Port. Make sure that you make a request response port. And connect he response port to the receive output.
Next connect the port output to the send_output.
Specify the port binding always later!
And set Activate is ‘true’ at the first input node.
Deploy the solution!
Go back to the administration console
Create a static one way receive port and define a location where we can place the input message so that BizTalk can pick the file up.
Next connect the port output to the send_output.
Specify the port binding always later!
And set Activate is ‘true’ at the first input node.
Deploy the solution!
Go back to the administration console
Create a static one way receive port and define a location where we can place the input message so that BizTalk can pick the file up.
Create a static one way send port and define a location where we can place the response message.
You can use our input file or you can generate an input schema by using the account_entities schema. If you do that you will get a large XML message. If you put this message in your input map it will not work. So we have to adjust this message. To keep it simple we will only add a few lines into CRM.
If you create your own input XML keep a few things in mind:
- Clear the crm_action attribute or place ‘create’ or ‘update’ in it.
- Make sure that you deleted or cleared accountid, if you fill this field CRM will think you want to update an existing account.
Always remember: When the ‘accountid’ field is empty you create an account, and when the accountid field is filled with a GUID you update an account.
The best thing to do is empty the tag crm_action tag at the top of the xml. Because if you fill in create together with a GUID the you will get an error message.
If you copy our code you will have to change the namespace!
This is our input file:

Start the project, and put a copy of the input message in the input directory.
Let’s see if it worked:
Go to the CRM : http://10.217.33.115/loader.aspx
And you click at accounts, you will see that there is a new account added.
- Clear the crm_action attribute or place ‘create’ or ‘update’ in it.
- Make sure that you deleted or cleared accountid, if you fill this field CRM will think you want to update an existing account.
Always remember: When the ‘accountid’ field is empty you create an account, and when the accountid field is filled with a GUID you update an account.
The best thing to do is empty the tag crm_action tag at the top of the xml. Because if you fill in create together with a GUID the you will get an error message.
If you copy our code you will have to change the namespace!
This is our input file:
Start the project, and put a copy of the input message in the input directory.
Let’s see if it worked:
Go to the CRM : http://10.217.33.115/loader.aspx
And you click at accounts, you will see that there is a new account added.
Also there is an output message created in the output map. This will look like this:
In this output message you will see the GUID (between ID) which you can use to update this same account.
Update an account in MS CRM 3.0
Update an account in MS CRM 3.0
You have to place the account GUID from the output message at account ID in an input message. And if you want to make it perfect you set the CRM_action to update.

We changed a couple of fields and added the field ‘fax’ so you actually see the difference.
So if you put this XML in the input folder the fields will be updated
We changed a couple of fields and added the field ‘fax’ so you actually see the difference.
So if you put this XML in the input folder the fields will be updated
So now you created an insert and an update of an Account!
Authors
Marcel Fernee: marcel.fernee@microsoft.com
Henry Osagiede: henry.osagiede@atosorigin.com
Mark Wijngaarden: mark.wijngaarden@atosorigin.com
Resources
Create account:
http://blogs.msdn.com/brajens/archive/2007/05/27/using-microsoft-biztalk-dynamics-crm-adapter-part-1.aspx
Update account:
http://blogs.msdn.com/brajens/archive/2007/05/30/using-microsoft-biztalk-dynamics-crm-adapter-part-2.aspx
For connection to CRM:
http://msdn2.microsoft.com/en-us/library/aa684342.aspx
Authors
Marcel Fernee: marcel.fernee@microsoft.com
Henry Osagiede: henry.osagiede@atosorigin.com
Mark Wijngaarden: mark.wijngaarden@atosorigin.com
Resources
Create account:
http://blogs.msdn.com/brajens/archive/2007/05/27/using-microsoft-biztalk-dynamics-crm-adapter-part-1.aspx
Update account:
http://blogs.msdn.com/brajens/archive/2007/05/30/using-microsoft-biztalk-dynamics-crm-adapter-part-2.aspx
For connection to CRM:
http://msdn2.microsoft.com/en-us/library/aa684342.aspx