Skip to content

Commit 675871b

Browse files
authored
Created : "Unpublish public reports" Scheulded Job Script (#1017)
1 parent d198fed commit 675871b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Scheduled Job to query the report table for any reports that are Published or roles are set to Public and remove the public role from report.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var pubReport = new GlideRecord('sys_report');
2+
pubReport.addQuery('is_published=true^ORroles=public');
3+
pubReport.query();
4+
while(pubReport.next()) {
5+
//Obtain current roles report is shared with
6+
var removePublic = pubReport.roles;
7+
//Remove public role from string
8+
removePublic = removePublic.replace(/public/g, '');
9+
//Set report roles to new string value. Wihtout public role, report will auto unpublish
10+
pubReport.roles.setValue(removePublic);
11+
pubReport.update();
12+
}

0 commit comments

Comments
 (0)