VaranAwesomenow
Mega Sage

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);
},

type: 'CustReportUtils'
};

 

Test this in background script

 

gs.print(new CustReportUtils().generateSubject("Scheduled Execution of Rep"));

*** Script: Subject of scheduled report | 2021-05-03 04:00:00 to 2021-05-11 03:59:59

In scheduled report subject will contain following text

javascript:new QDReportUtils().generateSubject("Scheduled Execution of Rep");

Thanks
Anil
Version history
Last update:
‎05-10-2021 07:40 AM
Updated by: