BC Teardown #19: January 2nd and nobody can post

BC Teardown #19: January 2nd and nobody can post

Happy New Year. Your posting date says no.

The pain

The first business day of January, every invoice and journal fails. Finance is locked out until someone finds the setting and changes it by hand.

Why it happens

Allowed posting dates in General Ledger Setup are fixed dates. Someone types them in every month, and the one month nobody does is the month after the holidays.

Before: Dates typed in by hand

General Ledger Setup
  Allow Posting From: 12/01/2026
  Allow Posting To:   12/31/2026

Jan 2, 8:01 AM:
  Posting date is not within your
  range of allowed posting dates

# Admin is on vacation until Jan 5

After: A Job Queue entry that rolls the window

codeunit 50200 "DF Roll Posting Dates"
{
  trigger OnRun()
  var
    GLSetup: Record "General Ledger Setup";
  begin
    GLSetup.Get();
    GLSetup."Allow Posting From" :=
      CalcDate('<-1M-CM>', Today());
    GLSetup."Allow Posting To" :=
      CalcDate('<CM>', Today());
    GLSetup.Modify();
  end;
}

The result

On the 1st of every month the window moves by itself: last month stays open for the close, this month opens on time.

Tip: User Setup can override these dates per user, so check both before year end.

Download this teardown as a PDF

Related teardowns


Got a Business Central problem like this? Free year end readiness review. Senior Microsoft certified developers, and you talk to the person writing the code. Contact Dataflow Solutions.