How to make dialog fields mandatory

See example below on how implement mandatory fields in dialog: boolean ret; FilePath workFolder; Dialog dlg; DialogField dfWorkFolder; FormStringControl fsc; FormGroupControl fgc; ; dlg = new Dialog( “@CDT135” ); dfWorkFolder

Some issues during changing index uniqueness

Some times we need to create a new unique index or alter existing one, but table may already contain duplicate data for this index and our changes could not be

How to get original value for table fields during record modification

Use table method orig(). It returns the orig buffer which is the committed version of the record in the database.

How dynamically change data source field properties

Example: myTable_ds.object( fieldNum( myTable, myField ) ).visible( false );

How to use select statements instead of query in data source

Override FormDataSource method executeQuery: public void executeQuery() { SomeTable T = this.cursor(); select * from T where …; } But be aware that in this case grid will not support

How to set focus when first time opening form

Override method firstField on a form, and call after super method setFocus of a control which should focused after form is opened. Example: public void firstField(int _flags=1) { ; super(_flags);

How to create EDT from code

It is impossible to create EDT from X++ using standard AOTAdd. AOTCompile causes Axapta crash and than unstable work. AOTSave method virtually doesn’t save anything. Solution: Use export/import methods. Steps:

How to check if AOT object name is valid

TreeNode::isValidObjectName( ‘Object name’ );

Search in AOT

Searching in AOT groups like Classes, Forms, etc. by scanning tree nodes is unacceptable due to performance reasons. For searching in AOT groups you should scan system table UtilElements. See

How to make data from temporary table available in form’s grid

Code in form’s outer scope: TmpTable tmpTable; FormRun formRun; ; … // Fill tmpTable with data here … args.record( tmpTable ); formRun = classFactory.formRunClass( args ); formRun.init(); formRun.run(); formRun.detach(); formRun.wait();