Wednesday, November 25, 2009

Connect from one one AOS to another AOS via X++ and execute commands

I had a requirement to connect from one Axapta instance to another instance staying in MORPHX IDE. I have done this lot many times using Visual Studio in my past, but never tried with MORPHX IDE.

So, here are the steps:

Step1

Go to AOT > References > Add Reference to Microsoft.Dynamics.BusinessConnectorNet.dll (this file is usually located in Client folder, default path if you choose C it would be C:\Program Files\Microsoft Dynamics AX\50\Client\Bin)




















Step 2

This piece of code shows how to connect to a remote AOS (Application), Here I'm just executing a class and retreiving the customer name. The LogonAs method used below is used to connect via the business connector proxy account as shown below. Otherwise the code is pretty straight forward










Troubleshooting/Error

I ran into this error (Screenshot shown below), Later I realised that on the remote AOS where I was connecting to the business proxy information was not set in Administration > Security > System Accounts form.


No comments:

Post a Comment