- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 05:17 AM
Hi,
I have a requirement to share bulk reports to groups. Is it possible with fix script? or?
How to achieve this?
Thanks,
Priyatham.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:05 AM
Here you go.
var groupsare=new GlideRecord('sys_user_group');
groupsare.addEncodedQuery('active=true');//Pass desired users query here
//groupsare.setLimit(10); //uncomment to check for 10 records
groupsare.query();
gs.print(groupsare.getRowCount());
while(groupsare.next())
{
var sharereport=new GlideRecord('sys_report_users_groups');
sharereport.initialize();
sharereport.report_id.setDisplayValue('TimeCard Trend'); //Pass report name
sharereport.group_id=groupsare.sys_id;
sharereport.insert();
gs.print(sharereport.getRowCount());
}
If any of above comments helped you can kindly mark it as Helpful & also get the thread closed once you got things working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 05:22 AM
Hey priyatham,
Here are the same threads you looking for, it might help you:
Mark Correct and Helpful, if it helps!
Best Regards,
Namrata.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 05:41 AM
Hi Priyatham,
There exists a Table: Report Users and Groups (sys_report_users_groups) that can be used.
You can write a script that will help you do the same.
var userare=new GlideRecord('sys_user');
userare.addEncodedQuery('active=true');//Pass desired users query here
//userare.setLimit(10); //uncomment to check for 10 records
userare.query();
gs.print(userare.getRowCount());
while(userare.next())
{
var sharereport=new GlideRecord('sys_report_users_groups');
sharereport.initialize();
sharereport.report_id.setDisplayValue('TimeCard Trend'); //Pass report name
sharereport.user_id=userare.sys_id;
sharereport.insert();
gs.print(sharereport.getRowCount());
}
It can also be altered to make it work for Groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 05:59 AM
Hi Jaspal,
Thanks for the reply, can you make it for groups?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:05 AM
Here you go.
var groupsare=new GlideRecord('sys_user_group');
groupsare.addEncodedQuery('active=true');//Pass desired users query here
//groupsare.setLimit(10); //uncomment to check for 10 records
groupsare.query();
gs.print(groupsare.getRowCount());
while(groupsare.next())
{
var sharereport=new GlideRecord('sys_report_users_groups');
sharereport.initialize();
sharereport.report_id.setDisplayValue('TimeCard Trend'); //Pass report name
sharereport.group_id=groupsare.sys_id;
sharereport.insert();
gs.print(sharereport.getRowCount());
}
If any of above comments helped you can kindly mark it as Helpful & also get the thread closed once you got things working.