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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Backward scheduling and forward scheduling considering non-working days

(0) ShareShare
ReportReport
Posted on by 144

Hi,

In my own code I need to do backward scheduling and forward scheduling considering non-working days based on the DateFormula-Field Item."Lead Time Calculation"
Is there a simple standard function I can use for this.

Thanks in Advance
Ralf

I have the same question (0)
  • DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    hi

    look this

    robertostefanettinavblog.com/.../

    learn.microsoft.com/.../dateformula-data-type

    DAniele

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    You should start by setting up a base calendar were you indicate what is working days and what are not working days.

    Then you take that calendar into considerations when you do your calculation.

    learn.microsoft.com/.../across-how-to-assign-base-calendars

    Then you have  codeunit 7600 "Calendar Management" that have some helper function that can help you find the next working day etc.

  • neckit Profile Picture
    144 on at

    The base calendar is assigned and I have indicated what are working days and what are not working day.

    But I have trouble recognizing and using the help function in the CU 7600. My code below works correctly but is very inefficient, so I would like to use this helper function. Could I get an example of forward and backward scheduling?

    procedure fnCalculateDateBackward(parDueDate: Date; parDateformula: DateFormula) StartDateL: Date
    var
        NumerOfDaysL: Integer;
        I: Integer;
    begin
        StartDateL := parDueDate;
        NumerOfDaysL := (CalcDate(parDateformula, 20010101D) - 20010101D);
    
        for I := 1 to NumerOfDaysL do begin
            StartDateL := CalcDate('<-1D>', StartDateL);                
            if CalenderMgmtG.IsNonworkingDay(StartDateL, CustomizedCalenderChange) then begin
                I := I - 1;
            end;
        end;        
    end;

  • Suggested answer
    YUN ZHU Profile Picture
    102,942 Super User 2026 Season 2 on at

    Hi, have you investigated codeunit 7600 "Calendar Management"?

    For example,

    pastedimage1667781888907v1.png

    pastedimage1667781938318v2.png

    Hope this can give you some hints.

    Thanks.

    ZHU

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 566 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 347 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 327 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans