- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 05:54 AM
Is there a way in reporting that I can populate the title with the date it relates to.
For example on my breadcrumb trail I specify I want all tickets created last month. Is there a way I can get the month name and possibly the year populated either on the report title or in the scheduled report email message?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 07:57 AM
There's not a simple shortcut unfortunately (the method SN has just gives you a month number), but it can be done with your own script include function to produce the month name. Here are the steps...
1) Navigate to 'System Definition -> Script Includes' and create a new record with the following settings...
Name: u_dateUtils
Client callable: True
Script:
var u_dateUtils = Class.create();
u_dateUtils.prototype = {
initialize: function() {
},
getMonthYearName :function(){
var gdt = new GlideDateTime();
var year = gdt.getYearLocalTime();
var month = gdt.getMonthLocalTime();
var monthName = '';
if (month == 0)
monthName = 'December';
else if (month == 1)
monthName = 'January';
else if (month == 2)
monthName = 'February';
else if (month == 3)
monthName = 'March';
else if (month == 4)
monthName = 'April';
else if (month == 5)
monthName = 'May';
else if (month == 6)
monthName = 'June';
else if (month == 7)
monthName = 'July';
else if (month == 8)
monthName = 'August';
else if (month == 9)
monthName = 'September';
else if (month == 10)
monthName = 'October';
else if (month == 11)
monthName = 'November';
return monthName + ' ' + year;
},
type: 'u_dateUtils'
};
2) Set the 'Subject' field of your scheduled report with the following line. It will call your custom function and return the Month/Year text you're looking for. Adjust as needed.
javascript: 'Report created: ' + new u_dateUtils().getMonthYearName();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 05:56 AM
How about this?
https://community.servicenow.com/community?id=community_question&sys_id=9dbaa9dcdbe493802328f3231f9619f7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 06:25 AM
That works great! I am still a bit of a novice at Java do you know what I would need to add to,
gs.nowDateTime();
So it just shows the previous month name?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 07:57 AM
There's not a simple shortcut unfortunately (the method SN has just gives you a month number), but it can be done with your own script include function to produce the month name. Here are the steps...
1) Navigate to 'System Definition -> Script Includes' and create a new record with the following settings...
Name: u_dateUtils
Client callable: True
Script:
var u_dateUtils = Class.create();
u_dateUtils.prototype = {
initialize: function() {
},
getMonthYearName :function(){
var gdt = new GlideDateTime();
var year = gdt.getYearLocalTime();
var month = gdt.getMonthLocalTime();
var monthName = '';
if (month == 0)
monthName = 'December';
else if (month == 1)
monthName = 'January';
else if (month == 2)
monthName = 'February';
else if (month == 3)
monthName = 'March';
else if (month == 4)
monthName = 'April';
else if (month == 5)
monthName = 'May';
else if (month == 6)
monthName = 'June';
else if (month == 7)
monthName = 'July';
else if (month == 8)
monthName = 'August';
else if (month == 9)
monthName = 'September';
else if (month == 10)
monthName = 'October';
else if (month == 11)
monthName = 'November';
return monthName + ' ' + year;
},
type: 'u_dateUtils'
};
2) Set the 'Subject' field of your scheduled report with the following line. It will call your custom function and return the Month/Year text you're looking for. Adjust as needed.
javascript: 'Report created: ' + new u_dateUtils().getMonthYearName();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 08:46 AM
You, Mark Stranger are a hero.
Thank you.