- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 10:34 AM
Hello,
I need to delete the Public Role from any reports in sys_report. I have tried one report below but is not working. Any assistance is appreciated.
Chad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 04:59 AM
Hi @purdue ,
Please use below script.
var reportrole = 'roles=public^title=App Service IDs';
var report = new GlideRecord('sys_report');
report.addEncodedQuery(reportrole);
report.query();
while (report.next()) {
if (report.roles.indexOf('public') > -1) {
var arr = report.roles.split(',');
arr.pop('public');
report.roles = arr.join(',');
report.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 04:59 AM
Hi @purdue ,
Please use below script.
var reportrole = 'roles=public^title=App Service IDs';
var report = new GlideRecord('sys_report');
report.addEncodedQuery(reportrole);
report.query();
while (report.next()) {
if (report.roles.indexOf('public') > -1) {
var arr = report.roles.split(',');
arr.pop('public');
report.roles = arr.join(',');
report.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 06:14 AM
Thanks Mr X. That works. I appreciate the help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 09:59 AM
Any chance you have a way to add a role to all reports? Say ITIL, snc_internal