How to get current month in the Schedueld report Subject

vspk
Giga Expert

Hi,

We are scheduling reports for monthly and daily incidents.

In the subject of that scheduled report, we need to show the current date and month for Daily and Monthly reports respectively.

I am able to set the date for daily report but I am facing issues to show the Month in monthly report.

Can anyone please help me here.

For the Daily report, this is the subject I am setting:

javascript:"Daily Report of incidents - " + gs.now();

It will send the email as: Daily Report of incidents - 08-02-2017

Similarly I want subject as: Monthly Report of incidents - August.

How to implement this

15 REPLIES 15

Mahesh79
Tera Contributor

Hi Guys,

 

I am also having similar requirement. I need the previous days date in the subject of a scheduled report.

 

Below is my code:

Script Include:

 

var DateReports = Class.create();
DateReports.prototype = {
initialize: function() {},
emailsubject: function() {
var gdt = new GlideDateTime();
var date = gdt.addDaysUTC(-1);
gs.addInfoMessage("testing" + date);
return date;
},

type: 'DateReports'
};

 

I am calling it in scheduled reports like this

 

javascript:DateReports().emailsubject();

 

 

I am not getting the date. Can you help me with the work around.

 

Thanks,

Mahesh.