Skip to main content

Notifications

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

(5) ShareShare
ReportReport
Posted on by 245
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.
 
  • Gerardo Rentería García Profile Picture
    19,066 Most Valuable Professional on at
    How to remove validations on city field on customer card in business central

    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

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    16,372 Super User 2025 Season 1 on at
    How to remove validations on city field on customer card in business central
    You would need to modify the logic that triggers the population of the postcode.
  • Suggested answer
    Jainam M. Kothari Profile Picture
    7,938 on at
    How to remove validations on city field on customer card in business central
    Hello,
     
    It requires Customization for the same.
  • KasparsSemjonovs Profile Picture
    4,209 Super User 2025 Season 1 on at
    How to remove validations on city field on customer card in business central
    This can be achieved only with some development.
     
  • Suggested answer
    Tech-Lucky Profile Picture
    1,012 on at
    How to remove validations on city field on customer card in business central
    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.
     
     
     
  • Suggested answer
    Holly Huffman Profile Picture
    6,085 on at
    How to remove validations on city field on customer card in business central
    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!

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,014

#2
YUN ZHU Profile Picture

YUN ZHU 950 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 624

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans