How it works...
We have introduced a couple of new concepts and statements in this recipe.
The switch statement should always be used on the validateField method, even if we only ever intend to handle one case. An if statement might seem easier, but it will make the code less maintainable. This goes for any check like this, where the cases have the possibility to increase.
The next new concept is that we can now declare variables as we need them. This helps with scope, but shouldn't be over used. The initValue and validateField methods are good examples of explaining where the code should be declared.
The AX 2012 systemGetDate() function is deprecated in this release. DateTimeUtil provides better handling for time zones. The date can be different ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access