BC Teardown #11: The customer number hardcoded since 2014

BC Teardown #11: The customer number hardcoded since 2014

Somewhere in your code, ‘C00010’ is doing a lot of heavy lifting.

The pain

Special pricing for one customer was hardcoded years ago. Now a second customer needs the same deal, and only a developer can give it to them.

Why it happens

Business rules written into code can only be changed by a developer, with a deployment, every single time.

Before: A rule nobody can see

if SalesHeader."Sell-to Customer No." =
  'C00010' then
  ApplySpecialPricing(SalesHeader);

// Who is C00010? Nobody remembers.

After: A setting users can change

tableextension 50170 "DF Customer" extends Customer
{
  fields
  {
    field(50170; "DF Special Pricing"; Boolean)
    { }
  }
}

// In the code:
Customer.Get(SalesHeader."Sell-to Customer No.");
if Customer."DF Special Pricing" then
  ApplySpecialPricing(SalesHeader);

The result

Finance ticks a box on the customer card. No developer, no deployment, no code archaeology.

Tip: Search your code for quoted customer, item and account numbers. Each one is a future support ticket.

Download this teardown as a PDF


Got a Business Central problem like this? Free 30 minute review of your setup. Senior Microsoft certified developers, and you talk to the person writing the code. Contact Dataflow Solutions.