- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2019 11:27 AM
Hey everyone,
So I was recently tasked with sharing 400+ reports created by 1 individual amongst 3 users. I am fairly new to service now and I am not too familiar with sharing reports or how to go about this. I am aware that you can share users 1 by 1, however with 400+ reports that could take a long time. I was hoping that I could use a script using a gliderecord that queries all of the reports that I am looking for and then being able to assign each users sysid to all reports that fit the query. If there are any other suggested ways to go about this I would really appreciate the help. I also have checked the article "Bulk sharing own reports" with no luck.
Thank you all,
Wilson
Solved! Go to Solution.
- Labels:
-
Analytics and Reports
-
Best Practices
- 8,457 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 07:15 AM
Thank you for the quick reply!
I played around with that code and found that the array wasn't working for some reason so I hard coded the 3 users and it worked fine. When I created a query for all the records I was looking for, I simply created 3 separate records within the sys_report_users_groups table that contained the user_id of each person and the report_id as the sys_id belonging to the sys_report that we are querying!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 05:51 AM
I know this is an old post, hopefully you can help me out. I'm trying to share multiple reports using your code. I get his error "Could not save record because of a compile error: JavaScript parse error at line (8) column (85) problem = unterminated string literal (<refname>; line 8)". It has a sqiggle line at parentheses "rep.addEncodedQuery(". Any idea on what I need to change?
// users sys_id list to whom you want to share report
var list = "53dd076f1b60c810432b0d0fdc4bcb97";
var arr = list.split(",");
for(i=0;i<arr[i];i++){
var rep = new GlideRecord('sys_report');
// add your encoded query to find multiple reports
rep.addEncodedQuery('title=Report_1
^ORTitle=Report_2
^ORTitle=Report_3
^ORTitle=Report_4
^ORTitle=Report_5
');
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
‎02-28-2024 02:36 AM
Hi Austin,
The field to write on "sys_report_users_groups" table is user_id
You can correct usr.user to usr.user_id.
Hope you have found the issue by now. Just wanted to comment here as well.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2021 01:08 PM
Hey Sachin. How would I modify this to work for user groups instead of single users? Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2024 02:40 AM
Similar to user_id field on sys_report_users_groups table, there is group_id field as well that you can utilize to share with groups.
Once again, I hope you have already found an answer to this, but just wanted to add it here for anybody else stumbling on this article.
Cheers.