Embedding reports in Jelly

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 13 minutes de lecture
  • 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>
    Tableau 1. Parameters
    Parameter Description
    targetSpan The jQuery element to embed the chart in. The chart uses the size of this element.
    reportId The 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>
    
    Tableau 2. Parameters
    Parameter Description
    targetSpan The jQuery element to embed the chart in.
    parms A 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>
    Tableau 3. Parameters
    Parameter Description
    targetSpan The jQuery element to embed the chart in. The chart uses the size of this element.
    reportId The sys_id of the report you want to embed.

    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.

    Tableau 4. Common parameters
    Parameter Description Default value
    jvar_report_id The 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_id Use this parameter instead of jvar_report_id when you want to override any of the other sysparm parameters that exist in the report.
    sysparm_title The title of the report.
    sysparm_table The table to report on. Specify this value or sysparm_report_source_id, but not both.
    sysparm_report_source_id The 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_type The 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_field The 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_query The 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<field_name> or ^ORDERBYDES<field_name> to the end of the query string. ORDERBY sorts the query by ascending order. ORDERBYDES sorts the query by descending order.

    sysparm_aggregate The aggregation type.

    Possible values: AVG, COUNT, SUM, and COUNT_DISTINCT

    COUNT
    sysparm_sumfield The field to aggregate data on. This parameter does not apply when using a COUNT aggregation type.
    sysparm_display_grid A true/false value that controls whether the report displays a data grid. false
    sysparm_show_other A 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_others The 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_type The source of the embedded report. Optional.

    Possible values: table, metricbase, source, import

    table
    sysparm_set_color The color setting for the report.

    Possible values: one_color, color_palette, several_colors

    color_palette
    sysparm_color_palette The color palette that the report uses. This parameter is used when sysparm_set_color="color_palette".

    Possible value: The sys_id of a color palette

    Default UI14
    sysparm_color The 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_colors The 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_marker A 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_empty A true/false value that controls if records with empty grouping or trend values appear on the report. false
    sysparm_stack_field The field used to control stacking on bar and column reports.
    sysparm_bar_unstack A true/false value that controls if stacked data is presented as a single bar or column, or as multiple bars. false
    sysparm_box_field The numeric field used to measure the data. This parameter is required for box and histogram reports.
    sysparm_trend_field The date-time field used to organize trend data. This parameter is required for time series, trend, and box reports.
    sysparm_trend_interval The interval to measure trend values by.

    Possible values: year, quarter, month, week, dayofweek, hour, and date.

    year
    sysparm_compute_percent The 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 count

    count
    sysparm_funnel_neck_percent A number 1–100 that defines the percentage of a funnel report that is the neck of the funnel. 30
    sysparm_show_chart_data_label A true/false value that controls if data labels appear on the report. false
    sysparm_show_zero A true/false value that controls if zeroes appear on multilevel pivot and heat map reports.
    sysparm_ct_row The field used to define the rows in heat map and bubble reports.
    sysparm_ct_column The field used to define the columns in heat map and bubble reports.
    sysparm_y_axis_category_fields The field used to define the rows in multilevel pivot reports. Specify up to five comma-separated field names.
    sysparm_x_axis_category_fields The field used to define the columns in multilevel pivot reports. Specify up to three comma-separated field names.
    sysparm_list_ui_view The sys_id of a list view to use when a user drills into the report.
    sysparm_show_marker A true/false value that controls if markers appear at every plotted point on a report. true
    sysparm_apply_alias A true/false value that controls if configured aliases appear in embedded reports.

    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.
    Tableau 5. Service catalog report parameters
    Parameter Description
    sysparm_sc_groupby_item_id The 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 the sysparm_field parameter when grouping on service catalog variables.
    sysparm_sc_groupby_variable_id The 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_id parameter.
    sysparm_sc_stackby_item_id The sys_id of a catalog item. Use this parameter with the sysparm_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_id The 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_id parameter.

    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.

    Tableau 6. Donut report parameters
    Parameter Description Default value
    sysparm_show_chart_total A true/false value that controls if the total score of the grouped donut appears in the center of the report. false
    sysparm_donut_width_percent A number 1–100 that controls the thickness of the donut report. 50
    Tableau 7. Heatmap parameters
    Parameter Description Default value
    sysparm_use_color_heatmap A 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_color The 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_color The 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
    Tableau 8. Dial parameters
    Parameter Description Default value
    sysparm_gauge_autoscale A 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_from A number that defines the minimum value for the axis scale.
    sysparm_to A number that defines the maximum value for the axis scale.
    sysparm_upper_limit A number that defines the upper threshold for the dial. If you do not specify a value, the dial has no upper threshold.
    sysparm_lower_limit A number that defines the lower threshold for the dial. If you do not specify a value, the dial has no lower threshold.
    sysparm_direction A 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.
    Tableau 9. Size parameters
    Parameter Description Default value
    sysparm_chart_size The size of the chart in the report. Valid values are small, medium, and large. large
    sysparm_custom_chart_size Enable 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_height The height of the chart in the report, in pixels.
    sysparm_custom_chart_width The 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.
    Tableau 10. Title parameters
    Parameter Description Default value
    sysparm_report_title_size A number that defines the font size of the title. 16
    sysparm_report_title_color The title text color. This value must be the sys_id of a Color Definition [sys_report_color] record. black
    sysparm_title_horizontal_alignment Where 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_alignment Where 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_position A 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_position A 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_position A 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.
    Tableau 11. Border parameters
    Parameter Description Default value
    sysparm_show_report_border A true/false value that controls whether the report displays a border. false
    sysparm_report_border_width A number that defines the width of the border, in pixels. 1
    sysparm_report_border_radius A 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.
    Tableau 12. Legend parameters
    Parameter Description Default value
    sysparm_show_legend A true/false value that controls whether the report displays a legend. true
    sysparm_legend_horizontal_alignment Where the legend is placed horizontally relative to the report.

    Possible values: left, center, and right.

    center
    sysparm_legend_vertical_alignment Where the legend is placed vertically relative to the report.

    Possible values: top, middle, and bottom.

    bottom
    sysparm_show_legend_border A true/false value that controls whether the legend displays a border. true
    sysparm_legend_border_width A number that defines the width of the legend border, in pixels. 1
    sysparm_legend_border_radius A 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.
    Tableau 13. X-axis parameters
    Parameter Description Default value
    sysparm_x_axis_title The name to display on the x axis.
    sysparm_x_axis_title_size A number that defines the font size of the x-axis title.
    sysparm_x_axis_title_bold A true/false value that controls whether the x-axis title text is bold. true
    sysparm_x_axis_opposite A true/false value that controls if the x axis appears at the top of the report. false
    sysparm_x_axis_display_grid A true/false value that controls if vertical grid lines appear from the x axis. false
    sysparm_x_axis_grid_dotted A true/false value that controls whether the vertical grid lines are dotted. false
    sysparm_x_axis_label_size A number that defines the font size for increment labels on the x axis. 11
    sysparm_x_axis_label_bold A 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.
    Tableau 14. Y-axis parameters
    Parameter Description Default value
    sysparm_y_axis_title The name to display on the y axis. An automatically generated description of the report aggregation
    sysparm_y_axis_title_size A number that defines the font size of the y-axis title.
    sysparm_y_axis_title_bold A true/false value that controls whether the y-axis title text is bold. true
    sysparm_y_axis_opposite A true/false value that controls if the y axis appears on the left of the report. false
    sysparm_y_axis_display_grid A true/false value that controls if horizontal grid lines appear from the y axis. true
    sysparm_y_axis_grid_dotted A true/false value that controls whether the horizontal grid lines are dotted. false
    sysparm_y_axis_label_size A number that defines the font size for increment labels on the y axis. 12
    sysparm_y_axis_label_bold A true/false value that controls whether the y-axis increment labels are bold. false
    sysparm_y_axis_from A number defining the lowest value displayed on the y axis.
    sysparm_y_axis_to A number defining the highest value displayed on the y axis.