Nota
O acesso a esta página requer autorização. Pode tentar iniciar sessão ou alterar os diretórios.
O acesso a esta página requer autorização. Pode tentar alterar os diretórios.
Version: Available or changed with runtime version 1.0.
Tests that the content of the field is not zero or blank (empty string).
Syntax
Record.TestField(Field: Any)
Parameters
Record
Type: Record
An instance of the Record data type.
Field
Type: Any
The field that you want to test.
Remarks
When TestField(Field) fails because the field is blank or zero, the runtime automatically adds a Show [Record] action button to the error dialog. This button navigates the user to the card page of the related record, allowing them to fill in the missing value. This automatic navigation behavior is built into the platform and doesn't require an ErrorInfo parameter.
How the platform determines the target page
The runtime resolves the navigation target by finding a Card-type page whose SourceTable matches the table of the record that failed validation. For example, if TestField fails on a Vendor record, the runtime identifies the Vendor Card page (a page with PageType = Card and SourceTable = Vendor) and uses it as the navigation target.
Limitations of automatic navigation
The automatic navigation provided by TestField(Field) has the following limitations compared to explicit ErrorInfo-based navigation:
- No field highlighting — The error dialog doesn't highlight or focus the specific field that needs attention. With
ErrorInfo, you can set FieldNo to direct the user to the exact field. - No custom button caption — The button always shows "Show [Record Name]." With
ErrorInfo.AddNavigationAction, you can provide a custom caption. - No custom page choice — The platform always navigates to the default card page for the table. With
ErrorInfo, you can specify any page using PageNo. - No detailed message — There's no additional context beyond the standard field-is-empty error. With
ErrorInfo, you can add a DetailedMessage with troubleshooting guidance.
When to use explicit ErrorInfo instead
Even though TestField(Field) provides automatic navigation, consider using the TestField(Field, ErrorInfo) overload with an ErrorInfo object when you need to:
- Highlight the specific field that requires attention
- Provide a custom navigation button caption
- Navigate to a page other than the default card page
- Add a detailed message or title to help the user understand the fix
- Add a Fix-it action that programmatically resolves the error
This behavior only applies to the single-parameter overload. The two-parameter overload TestField(Field, Value) doesn't provide automatic navigation — it displays a plain error message with an OK button only. To add custom navigation to a two-parameter
TestFieldcall, use the TestField(Field, Value, ErrorInfo) overload with anErrorInfoobject that specifies a page ID.