I try to automat a sales order process in Microsoft Dynamics AX 2012.
The company has its warehouse only in Sweden but selling companies even in other countries like Norway, Danmark … Sales orders (SO) are created in the country where the customer is placed, but shipped from Sweden.
I need to find the SO from the swedish company, but there I can only delete the data for Sweden. I can press the button “Open original Sales Order” which is only available for not swedish SOs. A new window is opend where I can mark the lines and delete.
The problems are:
- the new window is exactly the same as the swedish one except for the company code in the header
- for Sweden no new window is opened and I can not use exception handling to find out if a new window was opened or not.
- the activities for Sweden and the other countries are exact the same
- I can not be sure that the latest opened window is the active one
I tried to solve it with a “Attach window” with a variable selector containing the company name where I can delete the rows.
I works quite ok, but I have not found a way to close the “swedish” window when I even opened another country window.
Closing the latest opened window works fine.
I tried with “Close window” both with a selector and with the ApplicationWindow variable. I save the ApplicationWindow on ‘Attach Window’ both from the first swedish window and then from the second ‘Attach Window’ in different variables.