How to pass parameter to NOTIFICATION - VisualCron - Forum

Community forum

tburk
  •  tburk
  • No customer Topic Starter
2015-08-28T16:36:23Z
What is the simplest way to pass a DYNAMIC value to a Notification? I see how easy it is to use {JOB(PrevTask|Name)} variables in notifications, yet, how can a User Variable be easily passed to a Notification as well? Why don't Notifications have parameters already?

Thanks.
thomas
2015-08-31T09:43:34Z
I am assuming you are trying to use notifications under the flow tab? You can't pass variables to notifications from there unfortunately, and I really hope they fix that as it is annoying to work around it. I tend to make generic jobs and use conditions to get similar behaviour. If you tell us specifically what you are trying to achieve, we may be able to help you with a workaround


thomas
tburk
  •  tburk
  • No customer Topic Starter
2015-08-31T15:48:30Z
Thanks for the reply. Trying to achieve, ONE LOG notification, and ONE email notification to be used for ALL JOBS, so that 1] all PrevTask dynamic TASK variables can be used in the notification to enjoy dynamic variable usage, and, 2] no need to re-write repetitive logging TASKs for each JOB. Obvious examples of desired TASK variables include StdOut, StdErr. I think I found a work around, at the beginning of each JOB, as the first TASK, a User Defined Variable 'LogPathFile' is assigned a new value specific to the Active JOB, it also contains DateFormatted values as well. The notification then logs the PrevTask StdOut and StdErr values quite nicely to the Active JOB value placed into 'LogPathFile' using a 'Write File' TASK. It seems to be working for 2 separate JOBS, and I don't see any issues unless there comes a time when more than ONE VisualCron JOB is active. What do you recommend in the case of 2 concurrent active JOBs?
thomas
2015-08-31T16:09:01Z
Here is how I do it. We log errors to a database + send email

1) The db notification looks like this: proc.png

2)The mail notification looks like this (a basic version): mail.png

3) At the job level (flow tab), we call onerror twice: flow1.PNG

And inside the flow window it looks like this: flow2.png

When a job fails this notifications will be called and the variables, eg {JOB(Active|Name.. and so on, will refer to the job that failed. This works fine, the problem is if you want to pass additional information, like job variables
tburk
  •  tburk
  • No customer Topic Starter
2015-08-31T16:20:12Z
Thomas, that is interesting, pretty much what we are considering. A few questions come up, do you do any logging of successful TASKs? Do you do any FLOW control [logging, notifications...] at the TASK level?

And do any of your JOBs run concurrently? If you do run concurrent JOBs, how does that affect your {TASK(PrevTask... variables within your notifications?
Thank you.
thomas
2015-08-31T17:25:42Z
Running concurrent jobs makes no difference, it will pick up the variables from the job that calls the notifications. There is no risk of mixup there.

I don't log on task level, but it is perfectly possible, and may give you more fine-grained information. You could for example log errors at the job level, and successes at the task level, or any way you like. The logic would be the same, just call the 'on success' event at the task level. I assume that you know that VisualCron does it's own logging? Just righ click a job and select job log.


thomas
tburk
  •  tburk
  • No customer Topic Starter
2015-08-31T17:59:28Z
You bring up a good point about VC internal logging.
Scroll to Top