15.08.2007, 19:40 | #1 |
Участник
|
axaptapedia: Go To Main Table
Источник: http://www.axaptapedia.com/Go_To_Main_Table
============== Summary: New article, with dynamic Go To Main Table ==Introduction== The '''Go to main table''' functionality is a very useful and commonly used method of navigating between forms inside Dynamics Ax. By right-clicking on any control on a form which is bound to a table field, which in turn is based on an EDT which is a key to an Ax table, the user can select "Go to the Main Table Form" option which will open the "reference" form for that field. For example, if the user is currently viewing a Sales Order, they can right-click on the Customer Account field, select "Go to the Main Table Form" and be taken directly to the customer form. The customer which was used on the Sales Order will be preselected in the new form. ==Standard functionality== The standard functionality works in the following way: ''To be completed'' ==Dynamic behaviour== Sometimes we might want to modify the Go To Main Table functionality to be a little smarter. We might, as an example, have two different forms which are used to show SalesTable records, as follows: *Form SalesTable shows all records with the standard SalesTypes (with standard SalesTable menu item) *Form AJNewSalesTable shows all records with the new SalesType AJNewType (with a new AJNewSalesTable menu item). Each has a different filter applied to the SalesType field, to achieve the behaviour described. We then want the Go To Main Table functionality to always go to the correct form, without having to program on every single Salesid control on every single form. We can do this by setting the FormReference field on the SalesTable to point to a class which redirects the request to the correct form. Therefore we need to create a class (lets call it AJSalesTableMainTable) which will check the SalesType and open the correct form accordingly. We also need a Menu Item (also called AJRSalesTableMainTable for the example) pointing to that class. The FormReference property on the SalesTable table should then be set to RORSalesTableMainTable. Now when a user does a Go To Main Table on SalesId, it runs our class, which then opens the correct form according to the SalesType! Obviously the class could do much more than this simple check if necessary. The class (shown below) needs only one method (main) which is enough to do the job. For clarity, no error checking is shown. public static void main (Args _args) { SalesTable salesTable; ; salesTable = SalesTable::find(_args.lookupValue()); switch (salesTable.SalesType) { case SalesType::AJNewSalesType : // Our added type new MenuFunction(menuItemDisplayStr(AJNewSalesTable), MenuItemType::Display).run(_args); // New behaviour just for that type break; default : new MenuFunction(menuItemDisplayStr(SalesTable), MenuItemType::Display).run(_args); // Standard behaviour otherwise break; } } Источник: http://www.axaptapedia.com/Go_To_Main_Table
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|