How to get current month in the Schedueld report Subject
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 01:50 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:16 AM
Hi Sneha,
You can create a Script Include to fetch the current month as below and then call that Script include in your report subject:
var test = Class.create();
test.prototype = {
currMonth : function()
{
var gdt = new GlideDate();
var ans = gdt.getByFormat("MMMM");
return ans;
}
};
Call this Script Include in Report Subject as:
javascript:"This report is for " +currMonth();
Please mark Correct or Helpful as per impact of Response!!
Thanks,
Anjali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:32 AM
Hi Anjali,
I tried it but the subject is coming blank
Regards,
Sneha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:26 AM
Hi Priya,
Good Day
getMonth() - hellps to get the current month value.
Please find the below code for the same.
var gdt = new GlideDateTime();
gs.print("The Current Month is" + " "+ gdt.getMonth());
Output :- The Current Month is 8
It will returns the numerical value of the month, Jan=1,...............Dec=12.
Please mark Correct or Helpful if it helps you out
Thanks,
Priyanka R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:34 AM
Hi Priyanka,
I tried the same. I put the above code in script include and called it in the subject of scheduled report. but the report is coming with blank subject
Regards,
Sneha