Tuesday, November 13, 2018

Difference between Validate Field and Validate Write in AX

ValidateField

It is executed when we move the cursor from one field to another one. i.e ValidateField () fires every time the user changes the value in a field. The methods parameters give you the fieldId, It gives back a data of boolean type. If the result is false, the cursor will remain in the field.

The call to the super method () verifies the validation relations, that is to say, relations in a field where the Validate property has affirmative value. Therefore, we must respect the task made by this super method ().

Validations do not have to be codified that can be made with some property. Thus, we will avoid to write code in the ValidateField method if the conditions can be verified with the Validate property of a relation.


ValidateWrite

It is executed before inserting or updating a registry in the table. The validateWrite() method validates that each mandatory field is filled in, It gives back a data of boolean type. If it gives back false, the registry is not inserted or updates.

The call to the super method () examines all the fields to verify the value of the Mandatoryproperty. Therefore, we must respect the task made by this super method ().

We will avoid to introduce code that it verifies if a field has value, whenever we pruned to use the Mandatory property.

http://santoshax.blogspot.com/2013/07/how-many-types-of-data-validation.html
https://dynamicsuser.net/ax/f/developers/40057/when-to-use-validatefield-or-validatewrite-on-table

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// ...