Job in Queue dont run automatticaly

Hi everyone,

I'm new in the "job world" of navision. I'm using nav 2016 and we have a job in our system (table job queue entry) which run's a code unit every day of the week except saturday and sunday.

zjvfh2046os0.png


In the log table (job queue log entry) i can see that this job only run 4 times since it was created, and not every day...
I can' figure why is this happening..

az11aktu5n17.png

I read some stuff about server and client must be in the same domain, which is my case.
The user who created the job (not the admin) must have permissions, I guess he has..
I can't find any error / info in the event viewer of this specific job..


Codeunit 50001 code
OnRun(VAR Rec : Record "Job Queue Entry")

// >> type
//inParams := 'BankRec=10;'; // for tests
inParams := "Parameter String"; // >> for production
type := GetParametersType(inParams);

 // >> register in log
CreateLog(Rec, type, 'Starting', inParams, TRUE);

IF type = 'BankRec' THEN
BEGIN
  GetParametersSimple(inParams, params);
  
  IF EVALUATE(varAsInt,params[1]) THEN
    BankAccReconciliation(Rec, varAsInt);

END;

BankAccReconciliation(inJobEntry : Record "Job Queue Entry";inMarginDays : Integer)
// DELETE OLD LOG ("in progress" & <= 7 days)
DeleteOldLog(7);


BARec.SETCURRENTKEY("Bank Account No.");
//BARec.SETCURRENTKEY("Bank Account No.", "Statement Date");
//BARec.SETRANGE("Statement Date", inStartDate, inEndDate);

Count := 0;
CountExec := 0;
LogMessage := '';

IF BARec.FIND('-') THEN
REPEAT
  IF ((BARec."Bank Account No." <> xBARec."Bank Account No.") AND (xBARec."Bank Account No." <> '')) THEN
  BEGIN
    CreateLog(inJobEntry, 'BankRec', xBARec."Bank Account No.", LogMessage, FALSE); // >> register in log (last BAR)
    LogMessage := '';
  END;

  LogMessage += BARec."Statement No." + '; ';

  BARec.MatchSingle(inMarginDays);

  Count := Count + 1;

  xBARec := BARec;
UNTIL BARec.NEXT <= 0;

CreateLog(inJobEntry, 'BankRec', xBARec."Bank Account No.", LogMessage, FALSE); // >> register in log (last BAR)
CreateLog(inJobEntry, 'BankRec', 'Finished', 'Total: ' + FORMAT(Count), TRUE); // >> finish

LOCAL [TryFunction] CreateLog(inJobEntry : Record "Job Queue Entry";inType : Text;inMessage1 : Text;inMessage2 : Text;isFinish : Boolean)

Log.ID := inJobEntry.ID;
Log."User ID" := inJobEntry."User ID";
Log."Start Date/Time" := CURRENTDATETIME;
Log."End Date/Time" := CURRENTDATETIME;
Log."Object Type to Run" := inJobEntry."Object Type to Run";
Log."Object ID to Run" := inJobEntry."Object ID to Run";

IF isFinish THEN
  Log.Status := Log.Status::Success
ELSE
  Log.Status := Log.Status::"In Process";

Log.Description := inJobEntry.Description;
Log."Job Queue Code" := inJobEntry."Job Queue Category Code";
Log."Processed by User ID" := inJobEntry."User ID";
Log."Job Queue Category Code" := inJobEntry."Job Queue Category Code";

Log."Error Message" := inType;
Log."Error Message 2" := inMessage1;
Log."Error Message 3" := inMessage2;

Log.INSERT();






Answers

  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • KTA8KTA8 Member Posts: 388
    I don't get why bank reconciliation has to use job outside standar, it should be a process itself and then the job queue should call it everyday (except saturday and sunday).

    We've something similar taking data from banks and we didn't overwrited job queue.
  • catiamatos1991catiamatos1991 Member Posts: 158
    @KTA8 can you elaborate pls?
  • KTA8KTA8 Member Posts: 388
    @KTA8 can you elaborate pls?

    My point is that queue management is something standard, I don't see why you need to overwrite that functionality.
    The codeunit should do the process and you can use call it in the standard way.
  • catiamatos1991catiamatos1991 Member Posts: 158
    I'm trying to find a way to automatically run the "bank account recompilation" in specific days, without the "job" because it is not working and i'm not understand the way you're saying how can i solve this...
  • KTA8KTA8 Member Posts: 388
    In Job Queue Entries if you create a new entry, put report 1001 for example every day at 20:00. This will run that report without doing any development.
  • catiamatos1991catiamatos1991 Member Posts: 158
    edited 2018-10-22
    And how can I debug if it fails? It till log the error? I put to run my code unit 50001

    53cndfld2e1o.png


    Code Unit 50001
    Documentation()
    
    
    OnRun(VAR Rec : Record "Job Queue Entry")
    
    // >> type
    //inParams := 'BankRec=10;'; // for tests
    inParams := "Parameter String"; // >> for production
    type := GetParametersType(inParams);
    
     // >> register in log
    CreateLog(Rec, type, 'Starting', inParams, TRUE);
    
    IF type = 'BankRec' THEN
    BEGIN
      GetParametersSimple(inParams, params);
      
      IF EVALUATE(varAsInt,params[1]) THEN
        BankAccReconciliation(Rec, varAsInt);
    
    END;
    
  • KTA8KTA8 Member Posts: 388
    Standard makes a new entry each time it's used and if you press the error button, show you the error message if there's any problem.
  • catiamatos1991catiamatos1991 Member Posts: 158
    In table "Job Queue Log Entry" I don't have any new entry and it was supposed to run today at 5.30
  • KTA8KTA8 Member Posts: 388
    In table "Job Queue Log Entry" I don't have any new entry and it was supposed to run today at 5.30

    What codeunit or report are you working with?
  • catiamatos1991catiamatos1991 Member Posts: 158
    Codeunit 50001
  • KTA8KTA8 Member Posts: 388
    Codeunit 50001

    Use standard report to understand how it works.
Sign In or Register to comment.