How to embed the Report widget inside a Bootstrap Tab Menu ??

Akshay Palekar1
Kilo Contributor

My aim here is to embed the Report widget into a Bootstrap Tab Menu in the Service Portal. I have activated the Performance Analytics and Reporting service portal widget, which allows me to drag and drop the report widget into my container. When I drag and drop the report widget and select the report I want, the report is visible on the page, but if I try to embed the same report into the tab menu, I am unable to see the report and I can only see "Select a report in widget options!".

find_real_file.png

HTML Code:

<div class="tabbable-panel">
  <div class="tabbable-line">
    <ul class="nav nav-tabs ">
      <li class="active">
        <a href="#tab_default_1" data-toggle="tab">
          Comp </a>
      </li>
      <li>
        <a href="#tab_default_2" data-toggle="tab">
           Policy </a>
      </li>
      <li>
        <a href="#tab_default_3" data-toggle="tab">
          Risk </a>
      </li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane active" id="tab_default_1">
        <sp-widget widget=" c.reportWidget"></sp-widget>
      </div>
      <div class="tab-pane" id="tab_default_2">
        <widget id="report"></widget>
      </div>
      <div class="tab-pane" id="tab_default_3">
        <widget id="report"></widget>
      </div>
    </div>
  </div>
</div>

Client Script:

function(spUtil) {
  /* widget controller */
  var c = this;
	
	spUtil.get("report", {sys_id: "<my-report-id>"}).then(function(response) {
    c.reportWidget = response;
});

}

 

9 REPLIES 9

The forum has very bad searching engine. I posted answer on the question some months ago, but I can't find it. I guess that you use on Paris an old version of Report widget. There are exist a bug with assigning non-unique ids for multiple instances of Report widget. The problem is fixed later.

As far I can remind, the fixed version of Report widget uses as id report-widget-{{c.rectangleId}}, where c.rectangleId is different for every instance of the widget. Old buggy version generate HTML code with id duplicates and thus loading the second and all following reports failed. As far I can remember, exporting Report widget from more recent Release of ServiceNow (Quebec for example) and importing it on instance running old release should fix the bug. Probably, the line data.rectangleId = gs.generateGUID(); in server side code and small changes in client side, which uses data.rectangleId to set c.rectangleId are the changes of the bug fix. I analyzed the problem on one instance of our customer, debugged the problem and fixed, but I have currently no access to the instance.

Thanks for the reply Oleg, you are right that the widget seems to be out of date so I will get the code from the Quebec version and see how I go

ffr
Mega Contributor

Thanks for your explanation in the meantime i resolved my problem. I didn't settle the "c.options.widget.parameters" !

You are welcome! If your question is answered now then you could mark my previous posts as "Correct Answer"?

Alex McDonald
Tera Contributor

Is there a way to get this working in the more recent versions of ServiceNow (Paris, Orlando).

It seems like it will load the first result and the other reports will be stuck in a "Building chart, Please wait". 

Looking at the debugging I can see the different values for w1,w2,w3... are correct and present when looking at the console. Any work arounds?