Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Version: Available or changed with runtime version 1.0.
Tests whether the contents of a field match a given value.
Syntax
Record.TestField(Field: Any, Value: Any)
Parameters
Record
Type: Record
An instance of the Record data type.
Field
Type: Any
The field that you want to test.
Value
Type: Any
The value that you want to compare to Field. The data type of this parameter must match the data type of Field. If you include this optional parameter and the contents of Field do not match, then an error message is displayed. If you omit this parameter and the contents of Field is zero or blank (empty string), then an error message is displayed.
Remarks
Unlike the single-parameter TestField(Field) overload, this two-parameter overload doesn't automatically add a Show [Record] navigation button to the error dialog. When TestField(Field, Value) fails, it displays a plain error message (for example, "Status must be equal to 'Certified' in Routing Header...") with only an OK button.
This behavioral difference is by design: the single-parameter overload checks for a non-empty/non-zero value, and the platform knows the fix is "go fill in the field on the record." The two-parameter overload checks for a specific value, and the platform can't assume which page or action would resolve the mismatch.
If you want the error dialog to include navigation to a related record, use the TestField(Field, Value, ErrorInfo) overload and configure the ErrorInfo object with the appropriate PageNo and RecordId. You can also add a FieldNo to highlight the specific field that needs correction.