on 05-16-2014 3:05 AM
Hi guys,
New to SAP CPS, but need help in setting up the mail alerting based on following scenario:
Job chain contains 3 jobs: job_a, job_b, job_c. Custom mail definition is job_mail.
Path flow job_a->job_b->job_c.
Now in the chain flow, let us assume job_a works fine, job_b fails, the customer scenario is such that even if the job_b fails, the job_c should run. But job_b on error status should raise event say “EV_SendEmail”. My custom defined job_mail runs on wait event "EV_SendEmail" should run on the raise of this event. The job currently runs, sends out the email, but sends the job log and the job id of this job “job_mail”. Not the job_b’s id or the job_b’s log file.
How do I make this scenario work?
an easier way would be, create a small job chain:
Step 1 - Job b
Step 2 - mail_send on job b failure (relative job = setp 1, job 1; file = *)
Now if step 1 fails, set the status handler to move to step 2, but if it completes, mark the job chain complete.
Now add this small chain intead of job_b in the big job chain.
In bigger job chain, the step where you added the small chain, set all the status handlers to move the Job_c, irrespective of whether small chain is success or error.
Thanks
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nanda,
What you say makes sense if the job chain is small. But there is a very big job chain(nearly 50 steps and 50 jobs). If the customer wants alerting for each job in the job chain, then i have to create 50 small job chains in that big job chain and for each job, i have to have add a mail_send job to send the mail notifications. So, my job chain size would be (nx2) where n is the number of jobs in job chain.
I suggested this, but then the stakeholders told this is not going to make sense, hence wanted it through an event.
Warm regards,
Pavan
In that case,create a custom mail job in HTML format if you would like.
Now, create a parameter(constraint as expression) for that job, say PARENTJOBID and set the default value to
=waitEvents.name.raiserJobId
Now use this parameter in your mail body or subject, which will automatically be populated by the job that raised the event.
Similarly you can attach the files for the same job by mentioning under attachments like:
[Attachments]
Job $PARENTJOBID:*
thanks
Nanda
Hi Nanda,
I had actually tried your suggestion, it did not work(My source html had a syntax bug). But after what you told, I modified my source, now it gives me this error. Not sure where I am missing "=".
If you could let me know this, it would be great!
Screenshots are below.
I tried it like this:
Mail job source:
Event definition:
Job definition to raise event:
Error in CPS
Warm Regads,
Pavan
Hi HP,
Thanks, yours did the trick.
@Nanda: Thanks for the excellent help given, you helped me iron out my main flaw!
Just one last question, could you guys let me know if JobName gives me JobName, or is there any other variable in the jobcs class, so that I can get the JobName as well. Also, if you have the class definition of the class containing jobId, please do share here, so that I can check them out and write some custom script! Thanks a lot!
Warm Regards,
Pavan
Hi Pavan,
Please check out this: https://[::]:53000/scheduler/help/modules/mail/custom_mail.html
You might have to specify a different server and port, that help files lists the variables you have.
You can use the ${jobname} as follows::
job-${jobname}-file@{name}.txt=${jobid}:*
Regards,
HP
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.