how to share multiple reports to same users/groups at same time

Raja keerthana
Kilo Guru

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?

1 ACCEPTED SOLUTION

Saiganeshraja
Kilo Sage

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.

View solution in original post

9 REPLIES 9

Not applicable

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();
		
	}
}

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..?

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); 
	}
}

Saiganeshraja
Kilo Sage

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.