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
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
We've something similar taking data from banks and we didn't overwrited job queue.
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.
Code Unit 50001
What codeunit or report are you working with?
Use standard report to understand how it works.