Methods on a Form Data Source
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Each form data source has a set of standard methods. You override these methods when you want to change the behavior for validation, caching, and so on. These methods are a subset of the methods in the FormDataSource system class.
You use the AOT to access the standard methods:
Expand the node for the form data source on the form.
Right-click the Methods node.
Select Override Method.
Note
Code written on forms cannot be re-used or inherited. If possible, write your code on the underlying table or in a class.
The following table lists the methods that are available for form data sources and explains when they are executed. For more information about each method, click the method name.
Method name |
Executed when |
Description |
---|---|---|
The user selects a new record. |
Retrieves data from joined data sources when a user moves to a new record. |
|
The user creates a new record in the data source. |
Creates a new record in the data source. If you use this method to specify field values, the new values are saved to the database when you leave the form. |
|
Not run by the system. |
Used to notify application code of table events. |
|
The user clicks the mark area (uppermost left corner) in a grid control. |
Sets the default mark value for records in a form. |
|
The form data source record has been deleted. |
Runs instead of the delete post-super for a form where the ChangeGroupMode property of the form Data Sources node is set to ImplicitInnerOuter. |
|
The user deletes a record in the data source. |
Deletes the current record from the data source. |
|
The user deletes one or more marked (selected) records in the data source. |
Deletes all marked (selected) records from a data source. |
|
The form data source record is about to be deleted. |
Runs instead of the delete pre-super for a form where the ChangeGroupMode property of the form Data Sources node is set to ImplicitInnerOuter. |
|
Activated before a record is displayed. |
Sets the text color and the background color for a record in the data source. |
|
The form is opened for data display. |
Executes the data source query and displays the retrieved records. |
|
The user starts one of the Filter commands on the form shortcut menu. |
Filters records in the data source. |
|
Activated by the findValue method. |
Finds the specified record in the data source and makes it the current one. |
|
The user clicks the Filter by Field command in the shortcut menu on a form control. |
Finds the specified value in the data source and makes the record that has the specified value the current one by using the FormDataSource.findRecord method. |
|
Focus moves to the first record in the data source. |
Moves focus to the first record in the data source. |
|
Executed when it is called. |
Enables you to force a write operation on a record. |
|
The form is opened. |
Creates a data source query based on the data source properties. |
|
A new record is created. The purpose is to fill in initial values in the record. |
Initializes field values in a new record. If you use this method to specify field values, the new values are not automatically saved to the database when you leave the form. To specify values that you want to save when you leave the form, use the Create method. |
|
Focus moves to the last record in the data source. |
Moves focus to the last record in the data source. |
|
Focus moves to a new record or to a new data source. |
Provides notification when focus is moved to the next record or moved to another data source. |
|
Focus moves to a new record. |
Provides notification when focus moves to another record or another item on the form. |
|
The user selects a new record in a form that has a data source linked to another data source. |
Calls the FormDataSource.exeuteQuery method on data sources that are linked to the current data source. |
|
A record in the data source is marked. |
Enables you to mark a record in the data source. |
|
Not started by the system. |
Enables you to mark or clear all the loaded records. |
|
One or more records in the data source are marked or unmarked. |
Enables you to perform an action when there is a change to the number of marked records in the data source. |
|
Focus moves to the next record in the data source. |
Moves focus to the next record in the data source. |
|
The user requests the next page of data from the data source. |
Moves a specified number of records forward in the data source. Pulls the next page of data. |
|
Focus moves to the previous record in the data source. |
Moves focus to the previous record in the data source. |
|
The user requests the previous page of data from the data source. |
Moves focus back by a specified number of records in the data source. Pulls the previous page of data. |
|
The user starts the Print command in the File menu. |
Prints the current record. |
|
The user starts the Advanced Filter/Sort command (either from the Edit > Filter menu or by pressing CTRL+F3). |
Activates SysQueryForm, which is the standard form used to limit a query range. |
|
Not started by the system. |
Updates the form by refreshing the view of all records in the data source. |
|
A form is opened where records have been selected. |
Refreshes the view of the specified records. |
|
The user clicks the Remove Filter/Sort command in the shortcut menu on a form control. |
Resets the query for the data source. |
|
Not started by the system. |
Rereads the current record from the database. |
|
The value of a foreign key field is programmatically changed. |
Used to update the joined referenced data source for the current record when the foreign key field is programmatically changed. |
|
Not started by the system. |
Refreshes the database search defined by the query, specified by the FormDataSource.init method. |
|
The user selects or unselects one or more records in the data source. |
Enables you to change the property values of control when the selected record changes. |
|
The user has chosen to delete a record. |
Requests the user to confirm the deletion of a record from the data source. |
|
A new or updated record is to be written. |
Determines whether data is valid and ready to be written. |
|
The user inserts a new record or updates an existing one. |
Calls the FormDataSource.validateWrite method and manages the database write operation. |
|
The form data source record is about to be saved to the database. |
Runs instead of the write pre-super for a form where the ChangeGroupMode property of the form Data Sources node is set to ImplicitInnerOuter. |
|
The form data source record has been saved to the database. |
Runs instead of the write post-super for a form where the ChangeGroupMode property of the form Data Sources node is set to ImplicitInnerOuter. |
See also
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.