OBLYTECH Logo
OBLYTECH Logo

Reporting on Catalog Variables in ServiceNow: Group By and Filter

To report on catalog requests by a variable, build the report on the Requested Items or Catalog Task table, then add the variable as a group-by, a filter, a list column or a pivot axis. The variables come from the catalog item you select. This guide covers setup, roles, report types and the field limits that catch people out.

Check the report source before you build

Catalog variables belong to catalog items, so the report has to draw on a table that connects to them. Use the Requested Items table or the Catalog Task table. A source with no variables attached will not show the Variables option in the Group by and Stack by fields. For the wider concept of report sources, see report sources explained.

Two kinds of source are available. A data source is a table with filters already applied, so all users see the same view. A table source is the raw data with no filters, which suits an author who wants to set the conditions inside the report.

The request fulfilment and service catalog guides cover the catalog items these variables belong to. For the item itself, see catalog items explained.

Set up roles and access first

Report authors need one of these roles: itil, report_user, report_group, report_global, report_admin or admin. The author also needs the right to access the data the report reads.

Catalog variables need one extra step. For the table behind them, see the variable table guide. Users with the report_admin role can report on catalog variables. An administrator adds the report_admin role to the access control lists for the Options [sc_item_option], Variable Ownership [sc_item_option_mtom] and Variables [item_option_new] tables.

On the Australia release, creating a Core UI report also needs the system property com.snc.par.coreui.report_create.enabled set to true. Instances that were net new on Xanadu or later cannot create Core UI reports at all, so build a Platform Analytics data visualization there.

Group a Core UI report by a catalog variable

Core UI reports are created from the Platform Analytics Data visualization library.

  1. Open the Data visualization library, select Create data visualization, then select Core UI in the modal.
  2. On the Data tab, name the report after what it groups.
  3. Select a report source that has variables associated with it, then select Next.
  4. On the Type tab, select the report type and select Next.
  5. On the Configure tab, open the Group by or Stack by filter and select Variables.
  6. Search for the variable, select it, then finish configuring and styling the report for its type.

On the Yokohama release, upgraded instances that are not fully migrated to Platform Analytics create Core UI reports from Reports, then Create New. Fully migrated instances use Platform Analytics Administration, then Usage and governance, then Reports, then New.

Add a second grouping on a catalog variable

A primary grouping on a standard field, with a variable as a second grouping, shows how the variable divides each group. For example, requests by state can be split by a variable on the item.

  1. On the Configure tab, select a Group by filter, then choose Additional group by.
  2. Select Variables [+], then the structure icon, and choose a catalog item.
  3. The variables for that item appear in the Additional group by window. Move the ones you want to the Selected column and select OK.

The additional grouping works with any field in the main list.

Use catalog variables as list columns

A list report can show a variable’s value as a column alongside ordinary fields. Choose the columns, select Variables [+] at the bottom of the available list, use the structure icon to pick the catalog item, move the variables to the Selected column, and select OK.

A list report can use catalog variables as columns, but not as a primary or secondary Group by.

Split a multilevel pivot table by a variable

In a multilevel pivot table, a catalog variable can be a column or a row. Select Select columns or Select rows, choose Variables+ at the bottom of the list, use the structure icon and plus sign to find the catalog item, move the variable to Selected, and save.

How field order changes the join

The order in which you add fields changes how the pivot combines data. With the variable as the main Group By first, the variable behaves as an inner join. With a regular field for primary grouping and the variable as a secondary grouping, it works as an outer join.

A variable used as the main Group By behaves as an inner join, and a variable used as a secondary grouping after a regular field behaves as an outer join. Build the pivot in the order you need and check the totals.

Filter a report on a variable value

A variable can narrow the data as well as split it. Suppose a laptop request item has a memory variable. A filter on that variable can limit the report to one memory size, and the same filter can sit alongside a group-by on it.

Group and filter variables in data visualizations

Platform Analytics data visualizations have their own options. For chart options, see the Platform Analytics chart guide. Open All, then Platform Analytics, then Library, then Data Visualizations, and open the visualization. A variable can then be used in four ways.

  • As a filter: edit the data source, select Add custom conditions (or + Add if conditions exist), scroll to Variables at the bottom of the field list, choose the variable, the operator and the value, then select Apply.
  • As a group by: under Group by, select + Add, then Variables at the bottom of the list.
  • As an alternative group by: under Group by, select Add alternative group by, then Variables. Not all group-by variables are available as alternatives.
  • As a column or row in a pivot table: under Group by, select +Add for Columns or Rows, then Variables. The join behaviour from core pivots applies here too.

Creators need the viz_creator role or higher, including itil, and viewers need a role permitted by a report_view access control on the data source table. Roles other than viz_admin also need adding to the access control lists for the Options, Variable Ownership and Variables tables.

Let viewers choose the grouping at runtime

An alternative group by lets a viewer switch the grouping without editing rights. The selector can be shown or hidden with Change group by in the More actions menu, and an editor sets whether it is visible or hidden by default.

All visualization types that support group by offer this, except pivot tables. Bar visualizations also let a viewer pick a stack-by value, and a time series with several metrics might let the viewer choose a group-by for each one.

Know which report types accept catalog variables

For the report types themselves, see Core UI report types.

Core UI report type Catalog variable support
Types that group, such as bar, pie or time series Group by or stack by, provided the source has variables
List Column, not a primary or secondary group by
Box, Trendbox and Pivot Not a primary or secondary group by
Multilevel pivot table Column or row
Single Score, Calendar, Control and Map No grouping on any field
Data visualization type Catalog variable support
Types that support group by Filter, group by and alternative group by
Box and Trendbox Not a group by or alternative group by
Single Score, Calendar Report and Geomap No grouping on any field
Pivot table Column or row

Plan around database and field limits

These limits come from the database and field types, so check them early.

  • Oracle CLOB fields do not return variable data. A string column under 4000 bytes can be changed to varchar2, and smaller CLOB comparisons can use to_char(). Larger ones need dbms_lob.substr.

Share and export the finished report

On a Platform Analytics data visualization, the More actions menu holds the Export option, which can generate a PDF you can download or email. Calendar reports cannot be exported in any format.

Frequently asked questions

Can I group a report by a variable on a catalog item?

Yes. Build the report on the Requested Items or Catalog Task table, then choose Variables in the Group by or Stack by filter.

Why do pivot results change when I reverse the order of the fields?

The variable joins differently depending on its position. As the main Group By it behaves as an inner join, and after a regular field it behaves as an outer join. Rebuild the report in the order you need and compare totals.

Can a viewer change the grouping on a visualization?

Yes, when an alternative group by is set up. Pivot tables do not offer this choice.

Can I create Core UI reports on any instance?

No. Instances that were net new on Xanadu or later cannot create Core UI reports, so build a Platform Analytics data visualization on those instances.