web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Newbie Question - Emptying field

(0) ShareShare
ReportReport
Posted on by 10

Hi,

I'm new to AL Code (Any coding at all), and did manage to make most of my code work, the one thing I'm missing is that I can't wrap my head around how to allow emptying a previously filled field, when doing validation.

When I try to delete the Customer No. in my "Partner No."-field it's not allowed.

Help is much appreciated.

My code for the field:

        field(80; "Partner No."; Code[20])
        {
            Caption = 'Partner no.';
            TableRelation = Customer."No.";

            trigger OnValidate()
            var
                Customer: Record Customer;
           
            begin
                Customer.Get("Partner No.");
                PartnerName := Customer.Name;
            end;
        }

Error message

pastedimage1645609187215v1.png

  • Verified answer
    Bert Verbeek Profile Picture
    110 on at

    You do a Customer.Get with an empty value. Just put an if statement around that one.

    If Customer.Get("Partner No.") then

  • Verified answer
    YUN ZHU Profile Picture
    103,712 Super User 2026 Season 2 on at

    Hi, The following is some other solutions that I hope can help you.

    https://yzhums.com/22220/

    Thanks
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 740 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 570 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 291 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans