Search through blog..

Saturday, April 5, 2014

AX Menu items and how to create menu item

Menus Items
You can use menu items to activate application objects from the user interface.
Three types of menu items can be created:
• Display - used for forms
• Output - used for reports
• Action - used for running processes
Display Menu Items
Are used to open objects that appear on the screen, typically forms. For example, clicking the Customers menu item in the Accounts Receivable module opens the CustTableListPage form. This Display Menu item points to the Form object CustTableListPage.
There are two important Properties to notice.
• Object type = Form
• Object = CustTableListPage
 
How to: Create a Menu Item
Task: To create a menu item to open the AJ_BookTypeForm
To understand the example scenario - Go here
1. Open the AOT, expand the Menu Items node.
2. Open a second AOT and locate the AJ_BookTypeForm
3. Drag the AJ_BookTypeForm form to the Display node of the Menu Items node. A new display menu item is created.
4. In the properties sheet of the new menu item, set the label property to "Types of books".
5. Save your changes.

How to: Add a Menu Item to the Area Page
Task: to add the menu item created in the previous procedure to the area page. The main menu is comprised of a number of area pages. You will add your menu item to the AccountsReceivable area page.
1. Open the AOT, expand the Menus node.
2. Expand the AccountsReceivable menu.
3. Right-click the Setup sub-menu, and select New > Submenu. A new submenu Submenu1 is created.
4. In the properties sheet for the new submenu set the name property to "Library", and the label property to "Library details"
5. In a second AOT, locate the AJ_BookTypeForm menu item created in the previous procedure.
6. Drag the AJ_BookTypeForm menu item to the Library submenu.
7. Save your changes to the AccountsReceivable menu.
8. Open a new application workspace. The new submenu and the menu item are visible in the Accounts Receivable menu.
 
 
 
 
 
 
 
 
 

How to: Create a Form

To create a form that will be used to view, create and edit records in the AJ_BookTypeTable.

1. In the AOT, right-click the Forms node and select New Form.
2. Rename the form to AJ_BookTypeForm.
3. In a second AOT, locate the table AJ_BookTypeTable.
4. Drag the table AJ_BookTypeTable to the DataSources node on the AJ_BookTypeForm
5. Expand the Designs node on the AJ_BookTypeForm.
6. Right-click the Designs node and select New Control > Grid. A new Grid control is created.
7. Expand the DataSources > AJ_BookTypeForm > Fields node.
8. Drag the fields AJ_BookTypeID and Name to the grid control.
9. On the properties sheet for the Design node, in the Caption property, enter "Type of books".
10. Save your changes to the form.
To understand the example scenario - Go here 

Wednesday, April 2, 2014

How to: Create a Relation

Use this step procedure to create a relation between the AJ_SubGenreTable and the AJ_BookTypeTable. The Sub-genre is related to the BookType table.

For example, the Sub-Genre 'Poems' can be only related to the record "Poetry" in the AJ_BookTypeTable table. You should not be able to have a "Novels" as Sub-genre for "Poetry".
To understand the example scenario - Gohere
To understand more details about types of relations: Gohere.
1. In the AOT, locate the AJ_EDTBookTypeID EDT.
2. Right-click the AJ_EDTBookTypeID EDT and select Properties.
3. In the ReferenceTable property enter AJ_BookTypeTable.
4. Close the properties sheet.
5. Expand the AJ_EDTBookTypeID node.
6. Right-click the Table References node and select New > Table Reference. A new table reference is created.
7. Right-click the AJ_BookTypeTable Table Reference and select properties.
8. In the related field property, enter AJ_BookTypeID
9. Close the property sheet and save your changes to the EDT.
10. If the database synchronization dialog appears, click Yes.
11. Drag the AJ_EDTBookTypeID EDT to the field node on the AJ_SubGenreTable
12. When prompted to add the ForeignKey relation from the EDT, click Yes. This will automatically create the relation between the AJ_SubGenreTable and the AJ_BookTypeTable.
13. Rename the AJ_EDTBookTypeID field to AJ_BookTypeID.



 
 
 
 
 
 
 
 
 
 
 
Note: Relations can also be added manually by right-clicking the relations node on the table.
However when you create the reference on the EDT and set it as a primary key, once the EDT is added to a table, the system will prompt to add the reference automatically.

What are AX Table relations?

Relations between tables are used to:
* Associate rows in one table to rows in another table.
• Enforce business rules across tables
• Create auto joins in forms (join one table to another table).
• Look up values in other tables (using lookups and the View Details command).
• Validate data by providing constraints
• Automatically propagate changes from one table to another by defining cascading relations.
• Generating field help (hover over a field, and data from the related table is displayed).

Relationships can be created between tables using MorphX
• These relations are defined within the Microsoft Dynamics AX application and not at the physical database level.
• Relations govern the relationships between data in different tables such as foreign key relationships.
• Foreign key relationships between tables are always formed from the parent table.

Under the relations node you can create different types of relationships between the parent table and other tables in Microsoft Dynamics AX.
Normal: Specifies related fields in another table. Multiple fields can be included in this relation.
For example, table LogisticsPostalAddress has a relation called State that defines the relation to the LogisticsAddressState table. The values allowed in the state field are limited depending on which country is entered.
Field fixed:Specifies related fields that restrict the records in the primary table. The fixed field is normally an enum.
Related field:Fixed specifies related fields that restrict the records in the related table. The related fixed field is normally an enum.
ForeignKey: Specifies a correspondence between a foreign key field in the present table to the primary key field in another parent table. A ForeignKey can be a PrimaryKey or a Single Field Altenate Key.

When it is a Primary Key, the relation is on the primary key field, for example customer account. When it is a Single Field Alternate Key, the relation is on the surrogate key, which is usually the RecId.

To see an example on: How to create a relation - Go here

How to: Create an Index and set it as primary

How to: Create an Index

Use the following procedure to create a new index on the AJ_BookTypeID field on the AJ_BookTypeTable
NOTE: A field of data type memo or container cannot be used in an index.

To understand the example scenario - Go here
1. Locate the AJ_BookTypeTable table in the AOT.
2. Right-click the Indexes node in the table and select New Index. A new index Index1 is created.
3. Rename the index to AJ_BookTypeIDIdx
4. Drag the field AJ_BookTypeID to the index AJ_BookTypeIDIdx node.
5. In the properties sheet for the AJ_BookTypeIDIdx node, set the property AllowDuplicates to No.


How to: Set a Primary Index
Use the following procedure to set the index created in the previous procedure to be a primary index.
1. In the AOT, locate the AJ_BookTypeTable table.
2. In the property sheet for the table, set the PrimaryIndex property on the table to AJ_BookTypeIDIdx
3. Close the property sheet for the table.
 

Tuesday, April 1, 2014

How to: Create a New Table

Use the following step procedure to create a new table that will store the records for the BookType. There are two fields on the table called BookTypeID (type AJ_EDTBookTypeID), and Name (type Name).
To understand the example scenario - Go here

1. Open a new development workspace.
2. In the AOT, expand the Data Dictionary node.
3. Right-click the Tables node and select New Table. A new Table called Table1 is created.
4. Right-click Table1 and select Properties.
5. Modify the property Name to AJ_BookTypeTable
6. Modify the property Label to "Types of Books"
7. Close the property sheet.
8. Press Ctrl-D to open another AOT. Ensure window is not maximized by clicking the restore down button to enable you to view both AOT windows.
9. Expand the Data Dictionary node.
10. Expand the Extended Data Types node.
11. Locate the AJ_EDTBookTypeID EDT.
12. Drag the AJ_EDTBookTypeID EDT to the Fields node of the AJ_BookTypeTable table. A new field called AJ_EDTBookTypeID is created.
13. Right-click the AJ_EDTBookTypeID field and click Properties.
14. Note that the Extended Data type for this field is set to AJ_EDTBookTypeID
15. In the Name property, set the name of the field to AJ_BookTypeID
16. Close the property sheet.
17. Locate the Name EDT in the second AOT.
18. Drag the Name EDT to the Fields node of the AJ_BookTypeTable table. A new field called Name is created.
19. Save your changes to the table. When changes to a table are saved, Microsoft Dynamics AX automatically synchronizes the changes made within its Data Dictionary with SQL: this ensures that the definitions for the tables remain consistent at all times.
 

How to: Create a New Extended Data Type

Use the following procedure to create a new EDT that will define how the Id of the BookType is stored.
To understand the example scenario -
Go here


1. Open a new development workspace.
2. In the AOT, expand the Data Dictionary node.
3. Right-click the Extended Data Types node.
4. Select New > String. A new EDT called Type1 is created.
5. Right-click Type1 and select Properties.
6. Modify the property Name to AJ_EDTBookTypeID.
7. Modify the property Extends to SysGroup.
8. Modify the property Label to “Type of Book”.
9. Close the property sheet and click Save in the AOT to save your changes.
10. On the Database Synchronization dialog, click Yes. This will take a few minutes to complete.

How to: Create a New Model and Development Project

Example Scenario:

Let’s try out to learn more by building up an example scenario from scratch.
We shall have step-by-step procedures to demonstrate how to create a various levels of modification that can be used in Maintenance of Library. The procedure will need to keep track of each book that is borrowed, the readers who borrow, the Book type, the SubGenre of the book and details of each visit to library including the date, reason and the cost.

To do this you will need to create the following new tables.
• BookType table: This will contain entries such as Fact information, Current affairs, Non-fiction, Fiction, and so on.
• SubGenre table: This will contain the info about various sub-genres a book can have based on the book type. Would have entries like Novels, Biographies, Poems and so on. This should be related to the BookType Table.
• BookLendtable: This information is related to the customer table and BookType table.
• Visit transactions: This will contain the details of each visit for borrowing each book.


How to: Create a New Model and Development Project
The purpose of creating a model and a development project to keep our modifications organized.
Although, during your work you have to add any elements you modify or create should be added to this project. 

Task: Create a model called AJDEV and a development project called AJ_ProjectLibraryTrace
1. Click Tools > Model Management > Create Model.
2. Enter AJDEV in the model name, your name in the publisher and "Dynamics AX Project for Library Trace" in the description.
3. Click OK.
4. Click Close on the infolog dialog.
5. Press Ctrl-Shift-P to open the development projects window.
6. Right-click the Shared node and select New > Project.
7. Rename the project to AJ_ProjectLibraryTrace