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 223
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
    17,772 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
    14,835 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
    6,567 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,192 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
    935 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
    5,917 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans