Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 12:34 PM
Currently, about 450 reports are shared with users with itil role. I have a requirement to add an additional role so those reports will be shared with the user who has itil and this additional role.
Thank you
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 07:09 AM
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 06:14 AM
you can try this sample script and run in background. Please test it for 5 reports and if it works then comment the setLimit(5) line of code
updateRoles();
function updateRoles(){
try{
var reportTitles = 'Catalog item translation coverage'; // give here the title of those 450 reports
var gr = new GlideRecord("sys_report");
gr.addQuery("title", "IN", reportTitles);
gr.setLimit(5); // comment this after your testing
gr.query();
while (gr.next()) {
gr.roles = gr.roles + ',maint';
gr.update();
}
}
catch(ex){
gs.info(ex);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader