I want to create a generic notification task that tracks information about what job just ran. Ideally I'd like to track the success/failure of the job as well and I want to do it from a single notification.
So in my Notifications section on each job, I'd like to have it log to SQL Server the name of the job, the date/time run, the next run time, the description and if it was a success or failure.
Right now my notification is set for Complete and Failure - the problem is that if it fails, I get two entries in my database. One that it completed, the other that it failed.
I also notice that many times when I try to use the ActiveTask notifications - I get a lot of [Job does not exist or is not selected].
I set up a test notification that would email me when the job was complete. I set the body to:
Exit Code: {TASK(Active,ExitCode)}
Exit Desc: {TASK(Active,ExitCodeDesc)}
Output: {TASK(Active,StdOut)}
StdErr: {TASK(Active,StdErr)}
Status: {TASK(Active,Status)}
Result: {TASK(Active,Result)}
The email I got was:
Exit Code: [Job does not exist or is not selected]
Exit Desc: [Job does not exist or is not selected]
Output: [Job does not exist or is not selected]
StdErr: [Job does not exist or is not selected]
Status: [Job does not exist or is not selected]
Result: [Job does not exist or is not selected]
What's the best way to get information out of a job that just ran? I don't want to have to create a specific notification for every job.