Dynamic report title for reports

Akhilkumar2
Mega Contributor

Hi all,

i have some reports which need dynamic title.

i have the code to do it. but it is very long and not that efficient.

 

ar a = new GlideRecord('sys_report');
a.get('9d2afa8affaec3');
a.title = 'Monthly Request KPI by OE - Summary for '+getMonth();
a.update();

var b = new GlideRecord('sys_report');
b.get('3D756e18aad1effaef1');
b.title = 'Monthly Request KPI by OE - Summary for '+getMonth();
b.update();

var c = new GlideRecord('sys_report');
c.get('466991ae71fedb6b52be');
c.title = 'Monthly Request SLA- Service Family for '+getMonth();
c.update();

var d = new GlideRecord('sys_report');
d.get('3Ddc3ef28e6d7edb8056e18aad1effaeae');
d.title = 'Monthly Request SLA - Summary'+getMonth();
d.update();

var e = new GlideRecord('sys_report');
e.get('3D0be6484cc85ebb5e8bc');
e.title= 'Monthly Request KPI by Provider-Summary for'+getMonth();
e.update();
var f = new GlideRecord('sys_report');
f.get('3D69ab37cba52ebb5e852');
f.title= 'Breached CTASKS by Assignment Group - Summary'+getMonth();
f.update();

var g = new GlideRecord('sys_report');
g.get('3Daa7936b3c8c75700547cba52ebb5e862');
g.title= 'All CTASK by Service Family for'+getMonth();
g.update();

function getMonth() {
var monthNames = ',December,January,February,March,April,May,June,July,August,September,October,November'.split(',');
var gdt = new GlideDateTime();
var month=(monthNames[new GlideDate().getMonthLocalTime()]+":"+gdt.getYear());
return month;


}

 

Any one know how to short this using loops or something..

please post answer if you know..

 

1 ACCEPTED SOLUTION

VigneshMC
Mega Sage

No problem, Mark the correct answer and close this thread.

Thanks

View solution in original post

5 REPLIES 5

VigneshMC
Mega Sage

No problem, Mark the correct answer and close this thread.

Thanks