The eConnect Programmer’s guide discusses creating a custom XML node and stored procedure so developers can process new types of data. For example, a custom or 3rd party table could be updated when integrating a master record like a Customer or a transaction like a Sales Invoice using eConnect. The strategy that I will discuss below is for developers out there that would like to go one step further by referencing their own custom assembly. This assembly can be referenced in their Visual Studio project which would allow them to serialize the eConnect XML document with the custom node.
In the “Custom XML Nodes” section of the eConnect Programmers guide, the custom stored procedure is named eConnectCustomProcedure. It has one input parameter named CUSTNMBR that holds a Customer ID value. The custom XML node would look like this:
To use your custom XML node you will need to include this in a eConnect XML document like the following:
I then added a new complex type near the bottom of the file right above the </ xs:schema> end tag. I used the below string type for the CUSTNMBR parameter that the custom procedure needs like below:
Next I used the xsd.exe tool to build a new class based on the XSD file. I used the below syntax at a command prompt in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC directory. This is the Microsoft Visual Studio Command Prompt for Visual Studio 2010 that is available in the Microsoft Visual Studio 2010 program folder.
This step creates a class file named RMCustomerMaster.cs in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC folder. I added the new class file to a Visual Studio 2010 C# library project named RMCustomerCustomECONNECT that used a default namespace of RMCustomerCustomECONNECT. You could modify the code in the class file to add your own custom namespace but I left it alone using just the default from Visual Studio 2010. After building the project in Visual Studio 2010 it created an assembly named RMCustomerCustomECONNECT.dll.
Lastly, I made a reference to this new assembly and the Microsoft.Dynamics.GP.eConnect.dll assembly in my eConnect project. This is a C# Console Application that serializes the XML document with the custom node and passes it to the CreateEntity method of the eConnectMethods class. The code looks like the following:
I hope this post helps if you need to use custom XML nodes with your eConnect integrations.