Embedding multiple 'report' widgets does not work when using the sp-widget directive and $sp.getWidget. The provided widget can only be used once on any Service Portal Page.


Steps to Reproduce


1. Create a widget to add multiple embedded 'report' widgets in.

2. In the Body HTML template, use the sp-widget directive like:
<sp-widget widget="data.incidentReport">

3. Pass values to reference a Report record like so in the Server script field:
var incidentReportOptions = {
"report_id": "053275cf470111002ee987e8dee490ce",
"rectangle_id": "incidentGraphReport",
"widget_parameters" : "{ \"report_id\": {\"value\": \"053275cf470111002ee987e8dee490ce\",\"displayValue\": \"Open Incidents by Assignment\"},\"show_title\": {\"value\": \"true\",\"displayValue\": \"true\"}}"

data.incidentReport = $sp.getWidget('report', incidentReportOptions);

3. Repeat steps 2 and 3 but for another report, for example in the Body HTML template:
<sp-widget widget="data.problemReport">

Server script:
var problemReportOptions = {
"report_id": "a1c6198f470111002ee987e8dee4900b",
"rectangle_id": "problemGraphReport",
"widget_parameters" : "{ \"report_id\": {\"value\": \"a1c6198f470111002ee987e8dee4900b\",\"displayValue\": \"Problems By State\"},\"show_title\": {\"value\": \"true\",\"displayValue\": \"true\"}}"

data.problemReport = $sp.getWidget('report', problemReportOptions);

4. Add the widget to an empty portal page.

5. View the page and notice only the last embedded widget to be called displays its report, but it displays under the header/title for the first embedded widget to be called. The header/title for the last embedded widget shows the message "Building chart, please wait...". The first report can be seen briefly when initially loading the page in its expected place underneath its title/header, but is quickly replaced with the last embedded widget to be called.


This problem is targeted to be fixed in a future release.

Related Problem: PRB1298794

Seen In

There is no data to report.

Intended Fix Version


Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-02-04 13:08:57