Simple Scheduler Email if stopped

cwkelly23cwkelly23 Member Posts: 5
Goal: Have an email send when the scheduler receives an error or is hung. My code doesn't create an email. Is there a blog post somewhere that already explains how to accomplish this?

I have the following inside of the simple scheduler form to see if it has stopped.

Form - OnTimer()
IF FormStatus = FormStatus::Run THEN BEGIN
WORKDATE := TODAY;
ManualCheck;
END;



ManualCheck()

WITH SchedulerLine DO BEGIN
FIND('-');

REPEAT
CODEUNIT.RUN(CODEUNIT::NavisionTimer);

IF CheckCondition THEN BEGIN
COMMIT; // SCSPP 08.16.2012
CASE "Object Type" OF
"Object Type"::Report:
REPORT.RUN("Object ID",FALSE,FALSE);

"Object Type"::Dataport:
DATAPORT.RUN("Object ID",FALSE);

"Object Type"::Codeunit:
CODEUNIT.RUN("Object ID");
END;

"Last Day Run" := TODAY;
"Last Time Run" := TIME;

CASE "Interval Unit" OF

"Interval Unit"::Second: BEGIN
"Next Time Run" := TIME + (Interval * 1000);
IF "Next Time Run" < "Last Time Run" THEN
"Next Day Run" := TODAY + 1
ELSE
"Next Day Run" := TODAY;
END;

"Interval Unit"::Minute: BEGIN
"Next Time Run" := TIME + (Interval * 1000 * 60);
IF "Next Time Run" < "Last Time Run" THEN
"Next Day Run" := TODAY + 1
ELSE
"Next Day Run" := TODAY;
END;

"Interval Unit"::Hour: BEGIN
"Next Time Run" := TIME;

FOR Idx := 1 TO Interval DO
"Next Time Run" += (1000 * 60 * 60);

IF "Next Time Run" < "Last Time Run" THEN
"Next Day Run" := TODAY + 1
ELSE
"Next Day Run" := TODAY;
END;

"Interval Unit"::Day: BEGIN
"Next Day Run" := TODAY + 1;
END;

END;

MODIFY;

END;

UNTIL NEXT = 0;
NavTimer.ResetTimer;
END;


Any assistance would be greatly appreciated
Chris
Sign In or Register to comment.