How to open purchase order form in ax using c# code?

Hi All,

Is there any possibilty to open Ax PO form using C# code?

Firstly, I opened mstsc.exe using C# code, then Ax.axc file available in that server but I couldnt able to open PO form.

Kindly suggest me some solutions for it.

Regards,

Kuppusamy S.

Hi, first of all, it feels as if you are trying to create something weird and I would say unpleasant… to open a different application and manipulate the forms in it from another application…

I can give you a hint that you can dig in the direction of Startup commands. AX configuration can be called with additional parameters, which can be then processed by SysStartupCmd class framework where you can write your own code to make the AX do your intended startup process, which can as well be the opening of a PO form. Take a closer look at the SysStartupCmd::contruct() method. There, depending on the passed parameter keyword, a new startup class is being initiated and shortly after that also executed. You could start the AX from .axc file followed by an additional command which would state that a PO form should be opened immediately (hopefully you do not intend to also find and open a particular PO order as well, then it becomes even more problematic).

Hope you got the idea.

Janis.

Hi Janis,

Thank you for your response. Here my requirement is, When user clicks purchase button available in C# form, it should trigger mstsc and user will enter credentials. When credentials match up, it should open Ax and PO form. The important thing here is, PO form should open only when I navigate through this way but not when I open ax by clicking. axc file. I have done till Ax opening part but unable to open PO form. Could you let me know, Is there any possibilty to do using xml document which is explained in the below way and link,

1 Create an “action” menu Item for the form you want to open.

2 Create myFile.xml (note: version=“4.0” works in DAX2009 )

<?xml version="1.0" encoding="utf-8"?>

3 copy your .axc file and modify it as follows

startupcmd,Text,
TO
startupcmd,Text,Autorun_\myNetworkPath\myFile.xml

4 Open using the new .axc file for special form, open using old .axc for standard AX.

http://msdn.microsoft.com/en-us/library/aa876533(v=ax.10).aspx

When I tried using xml document, I got a error, “file is not a valid config file”.

Please let me know if you have idea about this.

Regards,

Kuppusamy S