- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 05:54 AM
There will be a requirement sometimes that multiple reports has to be shared with a user . it takes time to open every report separately and share them . Is there any way that I can select multiple reports and share it to the user simultaneously?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 06:14 AM
Navigate to the sys_report table and select whatever the reports you want to share and right click on any of the column --select update selected .Post that form will appear update the roles,groups fields info on the form accordingly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 06:12 AM
Hi Keerthana,
Please use the following code to share multiple reports with multiple users. Please customize as per your need.
Please mark this comment as Correct Answer/Helpful if it helped you.
Cheers,
Hardit Singh
var list = "62826bf03710200044e0bfc8bcbe5df1,a8f98bb0eb32010045e1a5115206fe3a";// users sys_id list to whom you want to share report
var arr = list.split(",");
for(i=0;i<arr[i];i++){
var rep = new GlideRecord('sys_report');
rep.addEncodedQuery('title=Cost Plan Break Down');// add your encoded query to find multiple reports
rep.query();
while(rep.next()){
var usr = new GlideRecord('sys_report_users_groups');
usr.initilize();
usr.user = arr[i];
usr.report_id = rep.sys_id;
usr.insert();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 07:40 AM
Thanks for the script. But I am not that well versed with scripting. Can you please guide me step by step on where should i go and use this script and so on..?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 04:19 PM
Some minor modifications to the script to correct syntax:
var list = "05c5f47b1b96194240xy5332bb4axi9a";// users sys_id list to whom you want to share report
var arr = list.split(",");
gs.print("array count: " + arr.length);
for(i=0;i<arr.length;i++){
gs.print("Adding permissions");
var rep = new GlideRecord('sys_report');
rep.addEncodedQuery('titleSTARTSWITHCMDB^ORtable=NULL');// add your encoded query to find multiple reports
rep.query();
while(rep.next()){
var usr = new GlideRecord('sys_report_users_groups');
usr.initilize();
usr.group_id = arr[i];
usr.report_id = rep.sys_id;
usr.insert();
// uncomment next line to include print statement on the permission addition
// gs.print("Added permissions for " + usr.group_id + " (" + usr.group_id.getDisplayValue() + ") to read " + rep.title);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 06:14 AM
Navigate to the sys_report table and select whatever the reports you want to share and right click on any of the column --select update selected .Post that form will appear update the roles,groups fields info on the form accordingly.