x
login Signup

How to include procedure output in email Notifier body with ElectricCommander?

I'd like my post-run email Notifier to include the output (stdout) of the procedure (and step) as text in the email. I was considering a number of options, such as capture all the output text in a variable in the procedure, and store that in a custom property of the jobStep, and then reference that in the email Notifier body.

Secondly, if the procedure output captured in a file in the workspace, then how would I reference that within the email notifier?

Is there a better way to handle this?

avatar image By h.berggren 65 asked Sep 21 at 10:32 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

The plugin procedure, EC-SendEmail / Send Email supports workspace file attachment. The trick is to find the name of the step log file and make sure that the same resource and workspace used in this step are used for the "Send Email" step.

The logfile name is: STEPNAME.JOBSTEPID -- presumably, you know the STEPNAME and only need to look up the JOBSTEPID. Use the command getJobDetails to see the structure of your job; from that you should be able to derive the JOBSTEPID.

Here's a property expansion that will return the JOBSTEPID:

 $[/javascript
     var STEPNAME="runCommand";
     var STEPID="";
     var steps = api.getJobDetails({"jobId" : myJob.jobId}).job.jobStep;
     for (var i = 0; i < steps.length ; i++) {
         steps[i].jobStepId;
         if (steps[i].stepName==STEPNAME) STEPID = steps[i].jobStepId
     }
     STEPID;
 ]

This code will extract the logfile name from the job details:

     var LOGFILENAME="";
     var steps = api.getJobDetails({"jobId" : myJob.jobId}).job.jobStep;
     for (var i = 0; i < steps.length ; i++) {
         steps[i].jobStepId;
         if (steps[i].stepName==STEPNAME) LOGFILENAME = steps[i].logFileName
     }
     LOGFILENAME;
 ]
avatar image By gregm 2k answered Sep 24 at 02:31 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.