Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Embedding reports in Jelly

You can embed reports in any Jelly-based element, such as a UI page.

Enabling Embedding

To enable embedding reports in Jelly, add the following element to your Jelly code.

<g:inline template="reporting_includes.xml" />

After adding this code, you can embed an existing report, or generate a report within the Jelly code.

Embedding an existing report

You can embed an existing report by calling the embedReportById(targetSpan, reportId) function.

For example, add the following to the HTML/XML block in the UI page record:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <div id="report_stuff" />
     </j:jelly>

And add the following to the Client script block in the UI page record. Replace <report sys_id> with the report's actual sys_id:

var div = $j("#report_stuff");
embedReportById(div, <"report sys_id">);

Alternatively, you can embed the JavaScript in the jelly code entirely in the HTML/XML block. Add the code from the client script block between <script> tags:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <div id="report_stuff" />     
     <script>
          var div = $j("#report_stuff");
          embedReportById(div, <"report sys_id">);
     </script>
     </j:jelly>
ParameterDescription
targetSpanThe jQuery element to embed the chart in. The chart uses the size of this element.
reportIdThe sys_id of the report you want to embed.

Generate and embed a report

You can embed a report within the UI by calling the embedReportByParams(targetSpan, parms) function. When embedding a report in this way, you can generate a new report using parameters, or specify a report sys_id to display that report.

For example, add the following to the HTML/XML block in the UI page record:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <div id="report_stuff" />
     </j:jelly>

And add the following to the Client script block in the UI page record:

var params = {sysparm_title: "Average for all ratings", sysparm_field: "category", sysparm_type: "bar", sysparm_table: "asmt_category_result", sysparm_aggregate: "AVG", sysparm_sumfield: "rating"}; 
var div = $j("#report_stuff");
embedReportByParams(div, params);

Alternatively, you can embed the JavaScript inside the jelly code. Add the code from the client script block between <script> tags:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <div id="report_stuff" />
     <script>
          var params = {sysparm_title: "Average for all ratings", sysparm_field: "category", sysparm_type: "bar", sysparm_table: "asmt_category_result", sysparm_aggregate: "AVG", sysparm_sumfield: "rating"};
          var div = $j("#report_stuff");
          embedReportByParams(div, params);
     </script>
     </j:jelly>
ParameterDescription
targetSpanThe jQuery element to embed the chart in.
parmsA JSON object defining the report. Available parameters depend on the report type.

Generating and embedding a list report

When you embed an existing list report or generate a list report and embed it, you must enter one more line of code.

Add the following to the HTML/XML block in the UI page record:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <g:inline template="list2_js_includes.xml" />  
     <div id="report_stuff" />
     </j:jelly>

Add the following to the Client script block in the UI page record. Replace <report sys_id> with the report's actual sys_id:

var div = $j("#report_stuff");
embedReportById(div, <"report sys_id">);

Or embed the JavaScript in the jelly code entirely in the HTML/XML block. Add the code from the client script block between <script> tags:

<xml version="1.0" encoding="utf-8">
     <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
     <g:inline template="reporting_includes.xml" />
     <g:inline template="list2_js_includes.xml" />
     <div id="report_stuff" />     
     <script>
          var div = $j("#report_stuff");
          embedReportById(div, <"report sys_id">);
     </script>
     </j:jelly>
ParameterDescription
targetSpanThe jQuery element to embed the chart in. The chart uses the size of this element.
reportIdThe sys_id of the report you want to embed.

Parent Topic:Advanced Core UI reporting topics

Embedded report parameters

When embedding a report in a Jelly element, you can define a report at any time by passing parameters.

Common parameters

Certain parameters are used by multiple report types.

Service catalog parameters

Certain parameters apply only to reports created on service catalog tables, such as the Requested Item [sc_req_item] table. These parameters are not available on list or calendar type reports.

ParameterDescriptionDefault value
jvar\_report\_idThe sys\_id of a report record. If you pass this parameter, do not specify any other parameters. All values are taken from the report record. 
sysparm\_report\_idUse this parameter instead of jvar\_report\_id when you want to override any of the other sysparm parameters that exist in the report. 
sysparm\_titleThe title of the report. 
sysparm\_tableThe table to report on. Specify this value or sysparm\_report\_source\_id, but not both. 
sysparm\_report\_source\_idThe sys\_id of a report source. Specify this value or sysparm\_table, but not both. This value is used instead of sysparm\_table if you pass both. 
sysparm\_typeThe type of report to create. Possible values: list, line, line\_bar, area, spline, bar, horizontal\_bar, pareto, hist, pie, donut, semi\_donut, speedometer, dial, pivot, pivot\_v2, funnel, calendar, pyramid, box, trend, control, trendbox, and heat map.line
sysparm\_fieldThe field from the specified table to group data by. Required for time series, column, bar, pie, donut, funnel, pyramid, box, trend, and trendbox reports. Optional for list reports. 
sysparm\_queryThe filter to apply to the data before generating the report. Specify a query string for this value. To sort your query results by a specific field, add `^ORDERBY` or `^ORDERBYDES` to the end of the query string. ORDERBY sorts the query by ascending order. ORDERBYDES sorts the query by descending order.  
sysparm\_aggregateThe aggregation type.Possible values: AVG, COUNT, SUM, and COUNT\_DISTINCTCOUNT
sysparm\_sumfieldThe field to aggregate data on. This parameter does not apply when using a COUNT aggregation type. 
sysparm\_display\_gridA true/false value that controls whether the report displays a data grid.false
sysparm\_show\_otherA true/false value that controls whether the Other group appears on the report. This group appears only if the number of groups exceeds the number specified in the sysparm\_others parameter. This parameter applies to bar, pie, funnel, pyramid, pivot, and heat map reports.true
sysparm\_othersThe maximum number of individual groups of data to display. Any additional data groups are combined into the Other group. This parameter applies to bar, pie, funnel, pyramid, pivot, and heat map reports. 
sysparm\_source\_typeThe source of the embedded report. Optional.Possible values: table, metricbase, source, importtable
sysparm\_set\_colorThe color setting for the report.Possible values: one\_color, color\_palette, several\_colorscolor\_palette
sysparm\_color\_paletteThe color palette that the report uses. This parameter is used when sysparm\_set\_color="color\_palette".Possible value: The sys\_id of a color paletteDefault UI14
sysparm\_colorThe color that the report uses. This parameter is used when sysparm\_set\_color="one\_color".Possible value: The sys\_id of a color 
sysparm\_chart\_colorsThe set of chart colors that the report uses. This parameter is used when sysparm\_set\_color="several\_colors".Possible value: A comma-separated list of color hex codes 
sysparm\_show\_markerA marker is the value represented by a dot in a line or another graphic element in a chart. This parameter is a true/false value that controls whether the marker appears.true
sysparm\_show\_emptyA true/false value that controls if records with empty grouping or trend values appear on the report.false
sysparm\_stack\_fieldThe field used to control stacking on bar and column reports. 
sysparm\_bar\_unstackA true/false value that controls if stacked data is presented as a single bar or column, or as multiple bars.false
sysparm\_box\_fieldThe numeric field used to measure the data. This parameter is required for box and histogram reports. 
sysparm\_trend\_fieldThe date-time field used to organize trend data. This parameter is required for time series, trend, and box reports. 
sysparm\_trend\_intervalThe interval to measure trend values by. Possible values: year, quarter, month, week, dayofweek, hour, and date.year
sysparm\_compute\_percentThe value to use when displaying report percentages. You can display percentages based on the total record count, or by the specified aggregate.Possible values: aggregate and countcount
sysparm\_funnel\_neck\_percentA number 1–100 that defines the percentage of a funnel report that is the neck of the funnel.30
sysparm\_show\_chart\_data\_labelA true/false value that controls if data labels appear on the report.false
sysparm\_show\_zeroA true/false value that controls if zeroes appear on multilevel pivot and heat map reports. 
sysparm\_ct\_rowThe field used to define the rows in heat map and bubble reports. 
sysparm\_ct\_columnThe field used to define the columns in heat map and bubble reports. 
sysparm\_y\_axis\_category\_fieldsThe field used to define the rows in multilevel pivot reports. Specify up to five comma-separated field names. 
sysparm\_x\_axis\_category\_fieldsThe field used to define the columns in multilevel pivot reports. Specify up to three comma-separated field names. 
sysparm\_list\_ui\_viewThe sys\_id of a list view to use when a user drills into the report. 
sysparm\_show\_markerA true/false value that controls if markers appear at every plotted point on a report.true
sysparm\_apply\_aliasA true/false value that controls if configured aliases appear in embedded reports. 
ParameterDescription
sysparm_sc_groupby_item_idThe sys_id of a catalog item. Use this parameter with the sysparm_sc_groupby_variable_id parameter to group a service catalog report based on a catalog variable value. These parameters replace thesysparm_field parameter when grouping on service catalog variables.
sysparm_sc_groupby_variable_idThe sys_id of the catalog item variable used to determine how data is grouped on the report. This variable must belong to the catalog item specified in the sysparm_sc_groupby_item_idparameter.
sysparm_sc_stackby_item_idThe sys_id of a catalog item. Use this parameter with thesysparm_sc_stackby_variable_id parameter to stack a service catalog report based on a catalog variable value. These parameters replace the sysparm_stack_field parameter when grouping on service catalog variables. Only reports that support stacking, such as bar reports, support these parameters.
sysparm_sc_stackby_variable_idThe sys_id of the catalog item variable used to determine how data is grouped on the report. This variable must belong to the catalog item specified in the sysparm_sc_stackby_item_idparameter.

MetricBase parameters

To use MetricBase in an embedded report, the sysparm_source_type parameter must be set to "metricbase".

MetricBase also requires the sysparm_custom_configuration parameter, which has the following syntax:

sysparm_custom_config: "{query_condition:\"\",transforms:[{transform:{transform:\"Reference\",name:\"chart-subjects\"},metric:\"mb_metricname\"}], group_by:\"\", table:\"mb_tablename\"}"; 

In this syntax:

  • A transform is a chain of nested transform functions. The last transform of every chain must always be the Reference transform:

    {transform:\"Reference\",name:\"chart-subjects\"}
    
  • A metric is a metric field of a metric table.

  • The group-by field is the field on the selected metric table by which the time series is grouped.
  • table refers to the metric table
  • mb_... are placeholder names

All attributes are required except for group-by.

Chart-specific parameters

Certain parameters are available only for specific report types.

ParameterDescriptionDefault value
sysparm_show_chart_totalA true/false value that controls if the total score of the grouped donut appears in the center of the report.false
sysparm_donut_width_percentA number 1–100 that controls the thickness of the donut report.50
ParameterDescriptionDefault value
sysparm_use_color_heatmapA true/false value that controls if the heatmap uses a gradient to color the report. When true, the sysparm_axis_max_color and sysparm_axis_min_color values are used.true
sysparm_axis_max_colorThe color used in the heatmap gradient to indicate a high value. This value must be the sys_id of a Color Definition [sys_report_color] record.UI14 blue
sysparm_axis_min_colorThe color used in the heatmap gradient to indicate a low value. This value must be the sys_id of a Color Definition [sys_report_color] record.white
ParameterDescriptionDefault value
sysparm\_gauge\_autoscaleA true/false value that controls if the dial automatically calculates the minimum and maximum scale on the report. If you set this value to false, you must specify a sysparm\_from and sysparm\_to value.true
sysparm\_fromA number that defines the minimum value for the axis scale. 
sysparm\_toA number that defines the maximum value for the axis scale. 
sysparm\_upper\_limitA number that defines the upper threshold for the dial. If you do not specify a value, the dial has no upper threshold. 
sysparm\_lower\_limitA number that defines the lower threshold for the dial. If you do not specify a value, the dial has no lower threshold. 
sysparm\_directionA value that controls which values are considered positive on the report, lower values or higher values. Possible values: minimize and maximize.minimize

Chart size parameters

Certain parameters control the width and height of the report.

ParameterDescriptionDefault value
sysparm_chart_sizeThe size of the chart in the report. Valid values are small, medium, and large.large
sysparm_custom_chart_sizeEnable this parameter to specify custom chart height and width values instead of using a size option from the sysparm_chart_size parameter.false
sysparm_custom_chart_heightThe height of the chart in the report, in pixels. 
sysparm_custom_chart_widthThe width of the chart in the report, in pixels. 

Chart title parameters

Certain parameters are available only for reports that display a title. These report types include time series, bar, column, pie, donut, dials, trend, box, trend box, histogram, pyramid, heat map, funnel, and control reports.

ParameterDescriptionDefault value
sysparm\_report\_title\_sizeA number that defines the font size of the title.16
sysparm\_report\_title\_colorThe title text color. This value must be the sys\_id of a Color Definition \[sys\_report\_color\] record.black
sysparm\_title\_horizontal\_alignmentWhere the title is placed horizontally relative to the report. This value is used only if sysparm\_custom\_report\_title\_position is false.Possible values are: left, center, and right.center
sysparm\_title\_vertical\_alignmentWhere the title is placed vertically relative to the report. This value is used only if sysparm\_custom\_report\_title\_position is false.Possible values: top, middle, and bottom.top
sysparm\_custom\_report\_title\_positionA true/false value that controls whether the x and y coordinates define the report title position instead of relative alignment.false
sysparm\_report\_title\_x\_positionA number that defines the x position of the title on the report. This value is used only if sysparm\_custom\_report\_title\_position is true.0
sysparm\_report\_title\_y\_positionA number that defines the y position of the title on the report. This value is used only if sysparm\_custom\_report\_title\_position is true.0

Chart border parameters

Certain parameters are available only for reports that display a border. These report types include: time series, bar, column, pies, donuts, dials, trend, box, trend box, histogram, pyramid, heat map, funnel, and control reports.

ParameterDescriptionDefault value
sysparm_show_report_borderA true/false value that controls whether the report displays a border.false
sysparm_report_border_widthA number that defines the width of the border, in pixels.1
sysparm_report_border_radiusA number that defines the radius size of the corners of the border, in pixels.0

Legend parameters

Certain parameters are available only for reports that display a legend. These report types include pie, donut, stacked bar, stacked column, time series, trend, box, histogram, pyramid, control, and heat map reports.

ParameterDescriptionDefault value
sysparm\_show\_legendA true/false value that controls whether the report displays a legend.true
sysparm\_legend\_horizontal\_alignmentWhere the legend is placed horizontally relative to the report.Possible values: left, center, and right.center
sysparm\_legend\_vertical\_alignmentWhere the legend is placed vertically relative to the report.Possible values: top, middle, and bottom.bottom
sysparm\_show\_legend\_borderA true/false value that controls whether the legend displays a border.true
sysparm\_legend\_border\_widthA number that defines the width of the legend border, in pixels.1
sysparm\_legend\_border\_radiusA number that defines the radius size of the corners of the legend border, in pixels.0

X-axis parameters

Certain parameters are available only for reports that use an X axis. These report types include bar, horizontal bar, pareto, column, line area, spline, box, trendbox, control, and trend reports.

ParameterDescriptionDefault value
sysparm_x_axis_titleThe name to display on the x axis. 
sysparm_x_axis_title_sizeA number that defines the font size of the x-axis title. 
sysparm_x_axis_title_boldA true/false value that controls whether the x-axis title text is bold.true
sysparm_x_axis_oppositeA true/false value that controls if the x axis appears at the top of the report.false
sysparm_x_axis_display_gridA true/false value that controls if vertical grid lines appear from the x axis.false
sysparm_x_axis_grid_dottedA true/false value that controls whether the vertical grid lines are dotted.false
sysparm_x_axis_label_sizeA number that defines the font size for increment labels on the x axis.11
sysparm_x_axis_label_boldA true/false value that controls whether the x-axis increment labels are bold.false

Y-axis parameters

Certain parameters are available only for reports that use a Y axis. These report types include bar, horizontal bar, Pareto, column, line area, spline, box, trendbox, control, and trend reports.

ParameterDescriptionDefault value
sysparm_y_axis_titleThe name to display on the y axis.An automatically generated description of the report aggregation
sysparm_y_axis_title_sizeA number that defines the font size of the y-axis title. 
sysparm_y_axis_title_boldA true/false value that controls whether the y-axis title text is bold.true
sysparm_y_axis_oppositeA true/false value that controls if the y axis appears on the left of the report.false
sysparm_y_axis_display_gridA true/false value that controls if horizontal grid lines appear from the y axis.true
sysparm_y_axis_grid_dottedA true/false value that controls whether the horizontal grid lines are dotted.false
sysparm_y_axis_label_sizeA number that defines the font size for increment labels on the y axis.12
sysparm_y_axis_label_boldA true/false value that controls whether the y-axis increment labels are bold.false
sysparm_y_axis_fromA number defining the lowest value displayed on the y axis. 
sysparm_y_axis_toA number defining the highest value displayed on the y axis. 

sndocs is an independent community mirror and is not affiliated with or endorsed by ServiceNow.

ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

© 2026 ServiceNow, Inc. All rights reserved.

Documentation content is redistributed under the Apache License 2.0 from the ServiceNowDocs repository.