Adding a Field to a Form in Microsoft Dynamics AX
How to add fields to forms in Dynamics AX (Formally Axapta)
The purpose of this blog is to give a brief overview of the process by which a user can add a field, whether it is a database field or a method, to an AX form. In this example, we will make two very simple modifications: We will add the Base Sales Price from the Price/Discount Tab to the grid in the Overview, and we will add a new check box to the grid that will indicate whether the item is a Web Store Item. Since “Web Store Item” is not an existing AX field, it will also need to be added to the database. AX2009 will be used and it is assumed that the user will have development rights in AX, and we will be placing the modification in the USR layer.
First, we’ll add the Base Sales Price to the grid. To do this, create a new project, and add the InventTable Form from the AOT to the Project. Once the form is in our project, we can create a copy of the existing Base Sales Price and add it to the grid.
Locate the Base Sales Price under the InventTable/Designs/Design/Tab:Tab/TabPage:PriceDisc/Group:PriceDiscSales/Group:PricesSales – called RealEdit:PricesSales_Price, Right-Click and select Copy, then navigate back up the tree to InventTable/Designs/Design/Tab:Tab/TabPage:Overview/Grid:Grid, Right-Click and select Paste. The Sales Price will be added to the far right of the contents of the grid. Rename and re-label the field to avoid confusion. Save your changes.
Next, we’ll add a new field to the database and then place it in the grid, directly to the right of the new Sales Price field.
First, add the InventTable Table to the Project. In my example, I’ve created some groups to keep from confusing the InventTable Form and the InventTable Table.
Once the table has been added, add a field to the table by a Right-Click on the Fields group and select New/Enum. Rename the field and change the Enum Type to NoYes.
Next, the new field will need to be added to the form, so go back to the InventTable Form, Right-Click the Grid again, and this time select New Control/Checkbox.
Rename the new field to WebStoreItem, set the label as desired, then select the InventTable as the DataSource, WebStoreItem as the DataField.