Search code examples
c#activexaxaptadynamics-ax-2009

ActiveX Component - Using external methods?


I've written an ActiveX component to be included in an AX2009 form. I have managed to include the component in the form and all works fine, however I would like to extend its functionality.

Is it possible to call AX methods from within the control and send their result back to the control? i.e. is there some way I could write code that calls a method external to the ActiveX control?

Alternatively, is there some way of passing a variable between the control and the AX form? This would be handy in order to restrict queries made to Data Tables using the variable value.


Solution

  • I've sorted this out by using the .Net Business Connector. Managed to pass a call using CallStaticRecordMethod with the table containing the method, and the name of the method I needed. CallStaticClassMethod can also be called if the method is part of a class (in AX).

    I'm then storing the return value in a variable in my .Net component and making use of the data.

    Hope this can help other out too.