Using Variables with Forms
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Variables usually need to be declared before they can be used. Working with forms, however, some variables are implicitly declared by the system.
Variables to Reference the Entire Form
The system creates the element variable. It is used to reference the entire form object.
The element variable is typically used in assignments, such as the following.
NotifyDate = element.design().control(control::NotifyDate);
Variables to Reference the Data Source Table
The system creates a variable. Its name is the same as the table's that is used as a data source. This enables you to do the following:
Call a method defined on the table used as a data source for the form. For example:
MyTable .setDefault(ReadWrite::write);
Reference the individual fields in the table. For example:
AccountNumber = MyTable .accountNo;
Variables to Reference Properties and Methods on the Form Data Source
The system creates a variable. Its name is the same as the table's that is used as a data source, but is postfixed with "ds." This enables you to reference properties and methods on the form data source (as opposed to the table itself), as shown in the following example.
MyTable_ds .research();
MyTable_ds .validateWrite();
See also
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.