How To Create Dynamic Report Title In Dashboard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2022 06:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 02:51 PM
Hi Himanshi,
Modify this script to get the final format you want:
Adding the Month and Year on the Report title:
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 == 😎
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();
Regards.
JP
JP