Skip to main content

Posts

Showing posts with the label external

Microsoft Dynamics® AX 2009: How to Call AX 2009 from an External Application and Open a Specific Form/Record

(This post courtesy of Natalia Efimtseva) Recently I worked with my colleague, Max Belugin, who is an expert in Dynamics. We were solving one interesting question—how you can activate and open a specific AX 2009 form/record from an external application or code. You can use following approaches to open AX from an external environment: 1. COM API Unfortunately, at the current moment .NET Business Connector doesn’t implement UI function, and thus it is not possible to open a specific AX form. But we can register AX32.EXE as a COM Object. static void Connect( string [] args) { AxClientLib.DynamicsAxApplication dynamicsClient; try { //find running Ax32.exe dynamicsClient = (AxClientLib.DynamicsAxApplication)System.Runtime.InteropServices.Marshal.GetActiveObject( "Dynamics.Application" ); } catch { //Launch new Ax32.exe dynamicsClient = new AxClientLib.DynamicsAxApplicationClass(); } if (dynamicsClient != null ) { //Run form dynamicsClient.OpenMenuItem( "DMO...

Connect External Data Base in Dynamics Ax 2009

This is the example to connect the External Database to Ax void ODBCConnection() { LoginProperty LP = new LoginProperty(); OdbcConnection myConnection; TableName TableName; Statement myStatement; ResultSet myResult; #define.Constring(“DSN=DSNNAME;UID=USERID;PWD=PASSWORD“) try { LP.setOther(#Constring); myConnection = new OdbcConnection(LP); } catch { info(“Check username/password.”); return; } myStatement = myConnection.createStatement(); new SqlStatementExecutePermission(“SELECT * from TableNamewhere bImportflag = 0″).assert(); myResult = myStatement.executeQuery(“SELECT * from TableNamewhere bImportflag = 0″); CodeAccessPermission::revertAssert(); while (myResult.next()) { TableName.nMember = Member; TableName.tMemberName = MembName; TableName.tMemberAddress = Address; TableName.tRescountry = Country; TableName.tRes...