Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


GiovanniRinaldi
2019-01-03T15:14:53Z
GoodMorning
I'm new to Visual Cron and I can't figure out how to create a to create a notification email that tells which is the failed tasks.
I have 7 jobs with 3 tasks each.
Each job quits with error if any of the tasks fails
If the job fails, sends an email message
I'd like to create a single notification object that tells:
a) The job that has failed (within the subject would be the best)
b) The task that failed within the job

Using the Visual Cron Variables I currently managed to write the Job name in the email message.
How can I write in the email also the name of the task that failed within the job?
I tried using the "Active Task" variable, but Visual Cron takes the email message sending activity as the active task
So, let's say for example, I have a job named "TestJOB" with 3 tasks named task1, task2, task3 and a notification object name "ErrorNotification"
If the testJOB fails (any task) i receive an email with text:

A scheduled job failed
Job Name: TestJOB
FailingTask: ErrorNotification


Could you please help me to get the failing task name in the email message?
Many Thanks
Sponsor
Forum information
Gary_W
2019-01-03T16:18:08Z
I don't think you'd want to get the failing task as the global server level. You can't guarantee it would be YOUR failing task (what if another task unrelated to yours failed before the e-mail was sent?). I believe you'd be safer and have greater error handling control if you caught the error in the flow and then called your own error handler job or task. Perhaps setting a job variable first with the task name before sending a notification e-mail. That way you get get more granular on how things are handled per job, task or per error.

Let's hope other folks will chime in how what they do. I will be interested as well.
bweston
2019-01-03T20:29:35Z
Since the overhaul (I think it was part of the major release of version 7?...maybe more recent) that made Notifications a type of Task under the hood (which, admittedly, made some other things far more versatile), if you want to refer to the task that caused a notification to be sent, you need to refer to the Previous Task, not the Active one.

Note that if you have jobs where a task can fail, and that means the job fails, but the job doesn't STOP at the failed task (I have some of these), a notification on failure at the job level will still report the previous task to be the last one that ran, which is no longer the one that failed. I have a few notifications that can be a little confusing because of this, and I really need to fix that, but because they only go to me I haven't gotten around to it yet.
thomas
2019-01-04T08:00:35Z
We use a very generic approach. It's far from perfect, but handles most cases well. We have error handling at the job level, not the task level.

We have created a notification that looks like this (html is to make it look nicer in outlook)

Capture.PNG

Under settings (server level), we have default flows (one email, and one db logger)

Capture.PNG

At the job level, click on 'Get default flows', and you are done.

Capture.PNG

If you have tasks that call other VC jobs, this does not work properly. The errormessage only says 'Child Job failed..'. Errors are not propagated properly. Hopefully this will be fixed some day
Scroll to Top