Job Queue run on earlier one day

xavierho970304xavierho970304 Member Posts: 5
Hi guys,

I have question want to ask, example my job queue set running on every Friday, but sometime holiday/rest day will fall on Friday, so my job queue want to running on earlier one day that mean run on Thursday, may I know how I can archive this scenario? I hope expert in NAV people can teach me to solve this problem.

Thank you.

Best Answer

Answers

  • xavierho970304xavierho970304 Member Posts: 5
    I know need to do new customize to handle this issue, but I am new in NAV. May I know have any sample code to handle this issue? Thanks
  • TryzubTryzub Member Posts: 2
    You can use Application Setup => Base Calendar to load / update non-working days. And then the Codeunit 7600 "Calendar Management" gives the functionality to check date status.

    The sample of usage to get the last working date in a month:
    ===========================================
    GetLastWorkDateForCustomer(inSCNo : Code[20];VAR aDate : Date) LastWorkDate : Date
        VAR
          Customer: Record 18;
          CalendarMgt : Codeunit 7600;
          tempStr: Text[50];
    BEGIN
    
      IF aDate = 0D THEN
        aDate := WORKDATE;
    
      LastWorkDate := CALCDATE('<CM>',aDate);
    
      Customer.GET(inSCNo);
      IF Customer."Base Calendar Code" = '' THEN
        EXIT;
    
      IF CalendarMgt.CheckDateStatus(Customer."Base Calendar Code",LastWorkDate,tempStr) THEN
        REPEAT
          LastWorkDate := CALCDATE('<-1D>',LastWorkDate);
        UNTIL NOT CalendarMgt.CheckDateStatus(Customer."Base Calendar Code",LastWorkDate,tempStr);
    
    END;
    
    
Sign In or Register to comment.