Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

I want to remove the one group name from multiple reports (sys_report) and from filter condition

Release: Australia
Shekhar Deshin1
Giga Guru

@Ankur Bawiskar 

 

I want to remove the one group name from multiple reports (sys_report) and from filter condition.

I want to remove that group name from multiple reports and update the report using fix script.

following i tried but it replacing the group name from old to new however how i can add the logic for removing only single group from multiple reports filter condtion please suggest.

 

because one group i can not remove from 100+ reports manually it's time consuming so please suggest script thanks.

 

//Reports Updates
var oldGroupId = 'db53a9290a0a0a650091abebccf833c6'; // Database San Diego
var newGrpID = 'db53580b0a0a0a6501aa37c294a2ba6b'; // Database Atlanta

var grReport = new GlideRecord('sys_report');
grReport.addQuery('filter', 'CONTAINS', oldGroupId);
grReport.query();
while (grReport.next()) {
gs.info('Report: ' + grReport.getValue('title') + ' | ' + grReport.getUniqueValue());
gs.info('current filter : ' + grReport.getValue('filter'));

var condition = grReport.getValue('filter');
var updated = condition.split(oldGroupId).join(newGrpID);
grReport.setValue('filter', updated);
grReport.update();
gs.info('updated:' + grReport.getValue('title') + ' | ' + grReport.getUniqueValue());
}

 

Thanks,

Shekhar,

0 REPLIES 0