What It Does

The isValidField() method performs a dictionary lookup to determine if a field exists on the current GlideRecord's table. It checks the table's field definitions without making a database query, comparing the provided field name against the table's schema as ServiceNow knows it at runtime.

Internally, ServiceNow consults the cached table definition to validate field existence. This validation respects your current scope and user permissions — a field that exists in the database but isn't accessible to your current scope will return false. The method also considers field-level ACLs, so fields you can't read may not be considered "valid" for your context.

The method returns true only when the field definitively exists and is accessible. It returns false for non-existent fields, fields outside your scope, misspelled field names, or when checking system fields on tables that don't inherit standard system fields. Unlike accessing the field directly, this method never throws exceptions.

Edge cases include extended tables where parent table fields return true even if accessed on a child table record, and custom fields that may exist in one environment but not another. The method also handles reference field checking — you should check 'caller_id' rather than 'caller_id.name' to verify the reference field itself exists.

This method complements isValidRecord() which checks record validity, and isValid() which validates the entire GlideRecord object state. Use isValidField() specifically for field existence validation before dynamic field access.

When to Use This

Use isValidField() when building generic utilities that work across multiple tables, before accessing fields from user input or configuration, or when your code needs to handle different ServiceNow versions or instances where field availability varies. Essential for Script Includes designed to work across scoped applications or when processing dynamic field lists from properties or user selections.

Don't use this for static field access where you know the field exists — it adds unnecessary overhead. For simple null checks on known fields, use direct field access with null checking instead. When you need to validate field values rather than field existence, use nil() or check the field value directly. Avoid using this in loops over large datasets where you're checking the same fields repeatedly.

⚠️

Don't confuse field existence with field access permissions. A field may exist but still return empty values due to ACL restrictions.

Return Value

Returns a primitive boolean value: true if the field exists and is accessible in your current scope and security context, false otherwise. Never returns null or undefined, making it safe to use directly in conditional statements without additional null checking.

The return value is immediately usable in if statements, boolean operations, and ternary expressions. Since it never throws exceptions or returns unexpected types, you can safely chain it with other boolean operations without defensive coding patterns.

Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime

Platform Behavior & Side Effects

  • No database queries executed — performs dictionary lookup only, making it very fast
  • No Business Rules, ACLs, or notifications triggered by this method
  • Results are based on cached table definitions, so recent schema changes may not be reflected until cache refresh
  • Respects current user's field-level ACLs — fields you can't access may return false even if they exist
  • Behavior is identical across Business Rules, Script Includes, and Scheduled Jobs
  • Considers application scope — fields from other scoped apps may not be visible
  • No audit trail or logging generated by field validation checks