preloader-matrix

Alfasith

Method Sequences in Dynamic AX

Event Method Sequences in Form Scenarios

User actions on a form are input through mouse pointers and keyboards. These actions cause events that are recognized by Microsoft Dynamics AX. The recognized events include the following:
•           Opening a form
•           Closing a form
•           Leaving a control
•           Leaving a record
•           Deleting a record
•           Creating a record
The system reacts to each event by executing several event methods. The user is often unaware that these methods are being executed.
Event Method Sequences when a Form is Opened
An event method sequence is executed when a form is opened. The specific sequence depends on the set of controls and data sources that are associated with the form.
Open a Form
________________________________________
In this example, the user opens a form that contains a grid control, which is bound to a data source.
The executed events are distributed across two threads. The timing of event method execution between threads can vary.
The following table shows the sequence that event methods are executed in when a user opens a form.
Method Where
new      Form
init       Form
loadUserSetting            Form
run       Form
init       Data source
executeQuery  Data source
leaveRecord     Data source
leave    Data source
leaveRecord     Data source
firstField           Form
firstField           Form
Event Method Sequences when a Form is Closed
Most forms in Microsoft Dynamics AX are closed when a user clicks the Close button (the standard button in the upper-right corner of most windows). Some forms can be closed by clicking either an OK or a Cancel button. When the form is closed, event methods are executed.
Close the Form by Using the Cancel Button
________________________________________
When a user closes a form by clicking the Cancel button, event methods are executed in the following sequence:
1.         closeCancel on the form.
2.         canClose on the form.
3.         close on the form.
Event Method Sequences when the Value of a Control Changes
Event methods are executed when the value of a control changes. The exact sequence of event methods varies for different controls.
Check Box Scenario
________________________________________
The example scenario uses a simple form that has a check box control. The check box is bound to a field in a data source.
A check box is a control that has a value property. In contrast, a grid control contains fields that each display a value, but the grid itself does not have avalue property.
Click to Change the Value in a Check Box
The following sequence of event methods is executed when the check box is either selected or cleared by a user.
1.         validate on the check box.
2.         modified on the check box.
3.         validateField on the table.
Remove Focus from a Check Box
The following event method is the only one executed when focus is removed from the check box:
•           leave on the check box.
Event Method Sequences when Focus is Removed from a Record
An event method sequence is executed when focus is removed from a record. The sequence includes the leaveRecord method. Form controls that simultaneously display multiple records have the leaveRecord event method.
Grid Scenario
________________________________________
This scenario has a form that contains a grid control, which is bound to a data source. The form is open, and the grid is populated with data. Focus is on the first line of the grid.
Move Focus from one Record to Another
Without changing any data, the user clicks a different grid line to move focus to that line. The following event method sequence is executed when data in the first line is unchanged.
1.         leave on the data source.
2.         leaveRecord on the data source.
A longer event method sequence occurs when grid line data changes before focus is moved from that grid line.
1.         modifiedField on the table.
2.         update on the table.
3.         aosValidateUpdate on the table.
4.         leaveRecord on the data source.
5.         leave on the data source.
6.         leaveRecord on the data source.
Event Method Sequences when a Record is Deleted
An event method sequence is executed when a record is deleted from a grid control. The grid control is on a form.
Grid Scenario
________________________________________
This scenario has a form that contains a grid control, which is bound to a data source. The data source is associated with a table. The form is open and the grid is populated. Focus is on the first line of the grid.
The user presses ALT+F9 to delete the record, and then clicks Yes to confirm. The following event methods are executed in response to that event.
1.         validateDelete on the table.
2.         delete on the table.
3.         aosValidateDelete on the table.
4.         leaveRecord on the data source.
Event Method Sequences when a Record is Created
Event methods are executed when a form is used to create a new record. The details can vary, depending on the type of controls present on the form.
Grid Scenario
________________________________________
In this scenario, a form contains one grid control. A data source is bound to the grid control. The data source is associated with two fields from a table.
A user opens the form, and then the grid is populated with data. The first line in the grid has focus.
A User Creates a Record
A user enters a new record by using a grid control on a form. They begin by pressing the shortcut keys CTRL+N. This creates a new, empty line in the grid and gives focus to the new line. The following list shows the sequence of event method executions that occurs when the user continues with the steps needed to create a record in the database.
1.         leaveRecord on the data source.
The user enters data into the first empty cell, and then presses TAB.
2.         validateField on the table.
3.         modifiedField on the table.
The user now enters data into the second empty cell. They click a grid line that is already populated to take focus from the new line.
4.         validateField on the table.
5.         modifiedField on the table.
6.         validateWrite on the table.
7.         insert on the table.
8.         aosValidateInsert on the table.
9.         leaveRecord on the data source.
10.       leave on the data source.
11.       leaveRecord on the data source.
Form Method calling Sequence in Dynamics AX
This gives the information of method calls in the form level while
          1. Opening the Form.
          2. Creating/Updating/Deleting the record in the Form.
          3. Closing the Form.
Sequence of Methods calls while opening the Form
Form — init ()
Form — Datasource — init ()
Form — run () 
Form — Datasource — execute Query ()
Form — Datasource — active ()
Sequence of Methods calls while closing the Form
Form — canClose ()
Form — close ()
Sequence of Methods calls while creating the record in the Form
Form — Datasource — create ()
Form — Datasource — initValue ()
Table — initValue ()
Form — Datasource — active ()
Sequence of Method calls while saving the record in the Form
Form — Datasource — ValidateWrite ()
Table — ValidateWrite ()
Form — Datasource — write ()
Table — insert ()      
Sequence of Method calls while deleting the record in the Form
Form — Datasource — validatedelete ()
Table — validatedelete ()
Table — delete ()
Form — Datasource — active ()
Sequence of Methods calls while modifying the fields in the Form
Table — validateField ()

Table — modifiedField ()

This below link takes you to details sequence as well how to implement / call that method.
http://www.slideshare.net/HamdaouiAmine/microsoft-dynamics-ax2012-forms-and-tables-methods-call-sequences-30159669

Regards,
Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.