Hi,
I want to send a mail using DSSendmail after job routine when ever job "Un-successfull". There is option to select run only when job is successful.
1) what if i don't check the box, will it send mail when job fails?
2) any other routine will help me out to send notification when the particular job fails .. any help!!
Thanks in advance
T
Notification - When job Unsuccessful
Moderators: chulett, rschirm, roy
I tried writing a routine but it is not working.. here is the code.. anything wrong.. It is sending the mail if the Job aborts .
Error message :- After-job routine returned error: Error variable unassigned on return from AFTER routine DSU.UnSuccessSendMail
Error message :- After-job routine returned error: Error variable unassigned on return from AFTER routine DSU.UnSuccessSendMail
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobHandle = DSJ.ME
JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)
JobInvId = DSJobInvocationId
if JobInvId ne "" then
JobName:= ".":JobInvId
end
Status = DSGetJobInfo(JobName,DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED or Status = DSJS.RUNWARN Then
Reply = DSSendMail(InputArg)
Begin Case
Case Reply = DSJE.NOERROR
ErrorCode = 0 ;* set to 0 - file checked OK, job continues
Case @True
ErrorCode = 1 ;* some other error, such as bad InputArg, stops the job if this is an after routine
End Case
End
-
- Charter Member
- Posts: 166
- Joined: Wed Mar 16, 2005 6:52 am
- Location: Mumbai, India
Hi Titto,
The simplest solution would be to wrap a Job Sequence around your existing Job. The sequence can do the following:
1. Job Activity Executes the Job. Output trigger is unconditional to second stage
2. Second stage is a nested condition stage with one output trigger with the following condition "Job_Activity_1.$JobStatus <> DSJS.RUNOK"
3. Third activity is the notification activity to send email.
Hope this Helps.
Amey Vaidya
The simplest solution would be to wrap a Job Sequence around your existing Job. The sequence can do the following:
1. Job Activity Executes the Job. Output trigger is unconditional to second stage
2. Second stage is a nested condition stage with one output trigger with the following condition "Job_Activity_1.$JobStatus <> DSJS.RUNOK"
3. Third activity is the notification activity to send email.
Hope this Helps.
Amey Vaidya