---
id: post/yzhums-com/70630
type: post
title: "Dynamics 365 Business Central: A universal method to check if a Field has a value in AL"
summary: The post explains how to universally check if a field contains a value in Business Central AL code using the HasValue procedure from the Change Log Management codeunit, which works across different data types without needing type-specific validation syntax.
tier: community
language: en
tags:
  - al development
  - field validation
  - data types
  - coding tips
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-26T06:40:57.499Z"
  flags: []
generated:
  at: "2026-10-26T05:51:10.938Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 3c9519f324145c4d85b927fec71d325dc6d96c99fd7ae05604adf32375ec1f32
evidence:
  - kind: blog
    url: https://yzhums.com/70630/
    title: "Dynamics 365 Business Central: A universal method to check if a Field has a value in AL"
    date: "2026-02-18"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://yzhums.com/70630/
    title: "Dynamics 365 Business Central: A universal method to check if a Field has a value in AL"
    date: "2026-02-18"
    commit: null
    t: null
    quote: Microsoft actually provides a standard method to address this.
  - kind: blog
    url: https://yzhums.com/70630/
    title: "Dynamics 365 Business Central: A universal method to check if a Field has a value in AL"
    date: "2026-02-18"
    commit: null
    t: null
    quote: All we need is to pass the FieldRef as a parameter.
links:
  learn: []
  objects:
    - object/codeunit/423
    - object/page/21
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
post_id: "70630"
source_id: yzhums-com
source_name: Dynamics 365 Lab - Yun Zhu
url: https://yzhums.com/70630/
published_at: "2026-02-18T00:45:50.000Z"
author: Yun Zhu
full_text: false
words: 202
quotes:
  - text: Microsoft actually provides a standard method to address this.
    why_it_matters: Directs developers to use the built-in HasValue procedure instead of writing custom validation code
  - text: All we need is to pass the FieldRef as a parameter.
    why_it_matters: Shows the simplicity of the universal approach that works for any field type
code_objects_mentioned:
  - codeunit Change Log Management
  - page Customer Card
systems:
  - development
  - platform
versions_mentioned: []
preview:
  embeddable: true
  frame_url: null
  image: https://yzhums.com/wp-content/uploads/2026/02/Snipaste_2026-02-18_09-44-45.png
  image_alt: null
  image_w: null
  image_h: null
  site_name: Dynamics 365 Lab
  favicon: https://yzhums.com/wp-content/uploads/2020/08/cropped-logo-3-32x32.png
  probed_at: "2026-10-26T06:09:00.069Z"
---

# Dynamics 365 Business Central: A universal method to check if a Field has a value in AL

[Read the post](https://yzhums.com/70630/) · Dynamics 365 Lab - Yun Zhu (Yun Zhu, MVP) · 2026-02-18 · 202 words · tier community · reviewed (checked by Opus)

> The post explains how to universally check if a field contains a value in Business Central AL code using the HasValue procedure from the Change Log Management codeunit, which works across different data types without needing type-specific validation syntax.

## Key points

- Business Central provides the HasValue procedure in codeunit 423 Change Log Management as a standard method for checking field values
- The method accepts a FieldRef parameter, making it work universally across all data types
- This approach eliminates the need for different validation syntax for different field types like Integer, Date, or Decimal
- The example demonstrates checking a Customer Name field by opening the Customer table, getting a field reference, and calling HasValue

## Quotes

- "Microsoft actually provides a standard method to address this." (Directs developers to use the built-in HasValue procedure instead of writing custom validation code)
- "All we need is to pass the FieldRef as a parameter." (Shows the simplicity of the universal approach that works for any field type)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- [codeunit 423 "Change Log Management"](../../objects/codeunit/423.md)
- [page 21 "Customer Card"](../../objects/page/21.md)

## Context

- Features: HasValue procedure, FieldRef handling, field validation, RecordRef usage

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
