How to handle issues with scheduled report subject length
Use case : If the subject of email in scheduled report should take dynamic value such as start date of month and end date of month, in which case you can use javascript notation and add that to the subject.
javascript:"ReportName |"+gs.beginningOfLastWeek()+"to"+gs.endOfToday();
The downside of this approach is, if the subject of report is too long then it wont let you add the formula gs.beginningOfLastWeek as field has size limit of 80 characters
To work around this subject can take javascript and a script include function call and in that function we can incorporate the logic to build the subject text. The function can take input as the alias name of report so that we can make the function reusable.
Sample script include code :
// Client callable = True
var CustReportUtils = Class.create();CustReportUtils.prototype = { initialize: function() { }, generateSubject: function(reportNameAlias) { var subjectOfReport = ''; if(reportNameAlias.indexOf('Scheduled Execution of Rep') > -1) { subjectOfReport = "Subject of scheduled report |"; } var subjectReturnText = subjectOfReport + gs.beginningOfLastWeek()+ " to " +gs.endOfToday(); return(subjectReturnText);
},
https://www.servicenow.com/community/now-platform-articles/how-to-handle-issues-with-scheduled-report-subject-length/ta-p/2328356