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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to remove validations on city field on customer card in business central

(4) ShareShare
ReportReport
Posted on by 305
Hi Guys,
 
In our default functionality,when we select city then post code is autopopulated on customer card.
I want to remove this functionality/validation.
output :post code sholud be empty when i enter on city.
Is any way to do this.
 
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,538 Super User 2025 Season 2 on at
    Good morning, afternoon, or evening depending on your location!
     
    To remove the validation that automatically populates the Post Code field when the City field is entered on the Customer Card in Business Central, you can modify the behavior using AL code. Here's how you can achieve this:
     
    Steps to Remove Validation
    1. Create a Table Extension:
      • Extend the Customer table to override the default behavior of the City field.
      • Remove or modify the OnValidate trigger for the City field.
        Example AL Code:
        tableextension 50100 CustomerExtension extends Customer
        {
            fields
            {
                field(50101; City; Text[50])
                {
                    trigger OnValidate()
                    begin
                        // Do nothing to prevent Post Code from being auto-populated
                    end;
                }
            }
        }
    2. Customize the Page:
      • Extend the Customer Card page to ensure the modified behavior is reflected in the UI.
        Example AL Code:
        pageextension 50101 CustomerCardExtension extends "Customer Card"
        {
            layout
            {
                addlast(Group)
                {
                    field(City; Rec.City)
                    {
                        ApplicationArea = All;
                    }
                }
            }
        }
    3. Test the Changes:
      • Deploy the extension and test the City field on the Customer Card.
      • Verify that entering a value in the City field no longer auto-populates the Post Code field.
     
    Alternative Approach
    If you want to retain the default functionality but allow manual entry in the Post Code field:
    • Use a custom field for the Post Code and map it to the original field only when needed.
    • This ensures the default validation logic does not interfere with manual input.
     
    Hope this helps some!
  • Suggested answer
    Tech-Lucky Profile Picture
    1,267 Super User 2025 Season 2 on at
    You can do this easily by creating an event subscriber for the OnAfterValidate trigger of the City field, and then setting the Post Code field to blank within that subscriber.
     
     
     
  • KasparsSemjonovs Profile Picture
    4,782 Super User 2025 Season 2 on at
    This can be achieved only with some development.
     
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,639 Super User 2025 Season 2 on at
    Hello,
     
    It requires Customization for the same.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,947 Super User 2025 Season 2 on at
    You would need to modify the logic that triggers the population of the postcode.
  • Gerardo Rentería García Profile Picture
    25,388 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Custom Address formats in Countries/Regions

    Custom Address Formatting - FORNAV

    Best Regards
    Gerardo

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,126

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 744 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 674 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans