How to Publish or Unpublish a Report (Report Builder Interface)


Description

ServiceNow Reports can be published to generate a URL that anyone can use to access the report, including people who are not users. When anyone navigates to the URL, the report is generated with current data from the instance. Reports are available until they are unpublished. This is done through the publication of that report.  This article describes the steps that can be used to publish or unpublish a report from an instance using the classic Report Builder interface.

Please refer to the following Documentation article on the Publish Report function for more information on its purpose, permissions, and accessibility: Publish a report

Before publishing any report, however, there are a few things that should be carefully considered regarding the accessibility of the report, such as the following:

Once a specific report is published it is assigned a special URL. That URL can then be accessed by anyone with public access to the instance.  No login or credentials are required, and thus publication can be used to provide access to data to those who do not necessarily have an account on the instance from which the data is stored and obtained.  With that in mind, the report should be reviewed to ensure it does not contain any data which should not be available to those without proper permissions. 

Procedure

If deemed that a particular report is safe for publication, the following steps can be used by an administrator to publish that report from the instance:

Publishing a Report

Before the actual publication of a report, it should be carefully reviewed to ensure it contains the necessary information and also that it contains no proprietary or other information that should not necessarily be accessible by the public.  If the report is considered ready for publication, the following steps can be performed for publication:

Log in to the instance with an account having the necessary permissions to access and publish that specific report.  This will require that the user has either the admin or report_admin role, or that the user has both the report_publisher and report_user roles associated with the account.

  1. Using the menu navigator browse to the following location on the instance: Reports -> View / Run.
  2. From the report lists, locate and open for editing the report you intend to publish.
  3. Click the Action Arrow button (which is found immediately to the right of the Save button).

  4. From the menu that appears, select the option titled Publish.
  5. After a moment, a message will appear indicating the report has been published and providing the URL to access the published report.
    Published Report URL

In fact, each time this report is opened for editing in the Report Builder Interface, this URL will be displayed at the top of the record display in this same manner.  This URL can then be copied and distributed to any person who might have the need to review this report.

The shareable URL generated for the report will be similar to the following format:

https://<instance-name>.service-now.com/sys_report_display.do?sysparm_report_id=<SYS_ID>

Where <instance-name> is the ServiceNow instance name on which the published report is found and <SYS_ID> is the unique, system-generated ID of this specific report on that instance.

Unpublishing a Report

Similar steps to publishing a report can also be used to unpublish a previously published report.  The following steps detail how this can be done.

  1. Log in to the instance with an account with admin or report_admin rights to the instance.  The account logged into will also need to have access to this report record on the instance.
  2. Using the menu navigator, browse to the following location on the instance: Reports -> View / Run.
  3. From the report lists, locate and open for editing the report you intend to unpublish.
  4. Click the Action Arrow button (which is found immediately to the right of the Save button).
  5. From the pop-up menu that appears, click the option titled Unpublish.
  6. After a moment a message will appear indicating the report is no longer public and the report will no longer be accessible from the public Internet.
    Report removed from publication
  7. Once removed from publication this report will no longer be accessible publicly using this URL.

Additional Information

How to search for a publicly published report in your instance

There are two options:

Option 1:

  1. From your instance, navigate to the ‘sys_report table 
  2. Filter "sys_report" table with the filter condition "roles = public" (embedded query: roles=public)
  1. Browse through the list and identify any report that does not necessarily need to be published 

Option 2:

Run this script to print the count of ALL published reports, not just predefined reports:

var grReport = new GlideAggregate('sys_report');
var reportQueryString = "roles=public";
grReport.addEncodedQuery(reportQueryString);
grReport.addAggregate('COUNT');
grReport.queryNoDomain();
if (grReport.next())
gs.print(grReport.getAggregate('COUNT'));

*Note: The "is_published" boolean column is just an informational column used for display on the list of reports page. The "roles" column is the one that controls which report is published and which is not.

When you unpublish a report (either by clicking on the unpublish button on the report designer or removing the "public" role) a business role kicks in and changes the “is_published” boolean value.

These instructions are specific to Publishing or Unpublishing a report using the classic Report Builder Interface.  For the instructions on report publication using the newer Report Designer Interface, please see the following article: How to Publish or Unpublish a Report (Report Designer Interface)

Also, it is possible to unpublish all the reports at once, ensure to test the below script before running on prod

function publicReports() {
    var reports = [];
    var grReport = new GlideRecord('sys_report');
    grReport.addEncodedQuery('roles=public');
    grReport.query();
    while (grReport.next()) {
      reports.push(grReport.title + ': https://yourinstance.service-now.com/sys_report_display.do?sysparm_report_id=' + grReport.sys_id);
        grReport.roles = grReport.roles.replace("public","");
        grReport.is_published = false;
        grReport.update();
    }
    return reports;
}
var goGetEm = publicReports();
goGetEm;