April 2017
Intermediate to advanced
706 pages
17h 8m
English
Another function, which is very similar to the TESTFIELD function, is FIELDERROR. However, where TESTFIELD performs a test and terminates with either an error or an OK result, FIELDERROR presumes that the test was already performed and the field failed the test. FIELDERROR is designed to display an error message and then terminate the process. This approach is followed in much of the standard NAV logic, especially in the Posting Codeunits (for example, Codeunits 12, 80, 90). The syntax is as follows:
TableName.FIELDERROR(FieldName[,OptionalMsgText]);
If we include our own message text by defining a Text Constant in the C/AL Globals | Text Constants tab (so the message can be multilingual), we will have the following line of code: ...
Read now
Unlock full access