cancel
Showing results for 
Search instead for 
Did you mean: 

Job run time to be sent in email

kedar0310
Explorer
0 Kudos

Hi,

I am looking for a solution for my client which has below requirements.

1. An email should be sent at successful completion of job. -- I am aware of this config

2. The email should contain the start time and end time OR job run time in the body of the email.

Please let me know if this is possible and if yes, kindly advise the detailed config and process.

Regards,

Kedar Pujari

Accepted Solutions (0)

Answers (2)

Answers (2)

h_carpenter
Active Contributor
0 Kudos

Hi Kedar Pujari,

How about creating a in job parameter on the mail job (replace 'Step 1, Job 1' with '<name_of_step>, Job <x>' where x is the number of the job of which you want the stats):

=Query.getNumber('select Job.RunTime from Job where Job.JobId = ?', [Query.getRelativeJob('Step 1,job 1')], 'n')

Alternatively (start time and end time):

=Query.getDate('select Job.RunStart from Job where Job.JobId = ?', [Query.getRelativeJob('Step 1,job 1')], 'n')

=Query.getDate('select Job.RunEnd from Job where Job.JobId = ?', [Query.getRelativeJob('Step 1,job 1')], 'n')

Then you reference that as ${Runtime}, ${RunStart}, ${RunEnd} in your mail source, respectively ...  I assume you will name the parameters as such ... 😉

Regards,

HP

nanda_kumar21
Active Contributor
0 Kudos

How are you sending an email now?

If you are using a HTML formal mail definition, add two 'in' parameters - Job Start and Job End.

In the job definition for which you want to report the start time and end time,

  • create two out parameters - job start time and job end time
  • write a post running action for the job definition to set these parameters with the actual run start time and run end time

Put these in a job chain and map the our parameters of the  job definition to the corresponding in parameters of Mail job definition.

Thanks

Nanda