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...
Suggested Answer

No validation when using DropDown

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I was wondering why a field won't validate when the DropDown function is used. For example, when I pick a City with DropDown, the field "City" won't validate, but when I type in the City, it does. Can someone tell me how I can get my field to validate after using the DropDown?

I couldn't find any question here in the forum so I'll ask myself. Any help is much appreciated. :)

problem.PNG

Best regards, natii

  • Community Member Profile Picture
    on at

    Natii,

    Look at the Post Code table to see if you have setup a Post Code and City combination to lookup.

    pastedimage1630506690193v1.png

    Thanks,

    Steve

  • wdfinuadf__ Profile Picture
    on at

    I don't exactly get what you mean. My question referred to the OnValidate Trigger, which doesn't run when I pick a City from Dropdown, the trigger only runs after typing it in manually.

  • wdfinuadf__ Profile Picture
    on at

    I don't exactly get what you mean. My question referred to the OnValidate Trigger, which doesn't run when I pick a City from Dropdown, the trigger only runs after typing it in manually.

  • Suggested answer
    Community Member Profile Picture
    on at

    Natii,

    If you want to validate the City, what I am stating is, by setting up the Post Code with a City and Country combination and then I enter City, you will see it open a validate list.  Here is my example to show you:

    pastedimage1630619143248v2.png 

    Now I will enter a City Atlanta and it will check the Post Code for 1 or more listing:

    pastedimage1630619213659v3.png

    Thanks,

    Steve

  • Suggested answer
    YUN ZHU Profile Picture
    104,090 Super User 2026 Season 2 on at

    Hi, yes, you are right.

    The city field is a bit special.

    In fact, you are not opening the table set in the TableRelation, but the Post Codes page.

    pastedimage1630645490590v1.png

    As for why there is no validation, because there is no validation in the program on purpose.

    pastedimage1630645542885v2.png

    pastedimage1630645574519v3.png

    The solution is also very simple, using OnAfterLookupCity event.

    pastedimage1630646153044v4.png

    A simple example:

    tableextension 50100 CustomerExt extends Customer
    {
        fields
        {
            modify(City)
            {
                trigger OnAfterValidate()
                begin
                    Message('Validated!');
                end;
            }
        }
    }
    
    
    codeunit 50100 MyCodeunit
    {
        [EventSubscriber(ObjectType::Table, Database::Customer, 'OnAfterLookupCity', '', false, false)]
        local procedure MyProcedure(var Customer: Record Customer)
        begin
            Customer.Validate(City);
        end;
    }

    [View:/cfs-file/__key/communityserver-discussions-components-files/758/ValidateCity.mp4:800:600

    Hope this will help.

    Thanks

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

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 677 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 430 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 280 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans