Run Dynamics Ax Class from Sql Management Studio


I have created a trigger in a table, that is in a second database, that insert data to a Temporary Sales table in Dynamics Ax. I have also created an insert method to Temporary Sales table, but unfortunately x++ cannot understand inserted data from sql as to activate insert method. Is there another way to run Dynamics Ax class from sql Management Studio …? Maybe by creating a service in AOT monitoring pending orders and run the class should solve my problem? Please advice.



If you wanted to synchronously call X++ code, you would have to use usual means for integration with external applications, namely WCF or Business Connector. But I don’t think it’s worth if you want to write data directly to DB anyway - if it’s fine to process data asynchronously by a periodic batch, it will be the easiest way.


I have managed to create Business Connector through visual studio. Although from dos command line it is running fine, when I execute it from management studio I get the following error

Unhandled Exception: Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException: You are not a recognized user of Microsoft Dynamics AX. Contact your system administrator for help.
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(BC_PROXY_ACCOUNT_INFO* pBCProxyAccountInfo, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(String company, String language, String objectServer, String configuration)
at DAXCmd.Program.CreateSalesTable(String[] arg)
at DAXCmd.Program.Main(String[] args)

The command from sql is Exec xp_cmdshell ‘C:\DaxBridge ES001 9977’ and I have logged in to sql with user that is administrator in DAX, but it seems that cannot recognize the credentials. Probably is there some other configuration in Dax…?