How To attach a file to an email notification from a JOBS object


Article ID: 198369


Updated On:


CA Automic Workload Automation - Automation Engine CA Automic Workload Automation - Automation Engine


In this scenario, the requirements are to attach a file available on a windows agent server to an email and send it to [email protected] using an OS job.  The file is called text.txt and is located in the C:\temp directory.


1) Create a job, in this case a windows job - update the agent and login in the attributes tab
2) In the Process tab of the job, use register_outputfile, for example:

:REGISTER_OUTPUTFILE "C:\temp\test.txt", "Y"

3) To use the out of the box email template for a notification, here called CALL.MAIL.ATTACHMENT, in the post process tab activate the object:

!This will put the &uc_cause_nr into the read buffer and give it this objects runid
:put_read_buffer uc_cause_nr = &$runid#
!activate call.mail.attachment (notification object) and pass the values put in the read buffer
:set &ret# = activate_uc_object("CALL.MAIL.ATTACHMENT",,,,,"PASS_VALUES")

4) Create the mail notification called CALL.MAIL.ATTACHMENT
5) In the "Notification" tab, add the recipient and be sure that under "Settings", the source is set to "External files"
6) Run the OS job created step 1.