GlideV2ChartingIncludesSP.js usage in Service Portal

Agmal
Kilo Contributor

Hi,

i have a question regarding the usage of GlideV2ChartingIncludesSP.js. I was trying to embed custom reports in the service portal by using the 'embedReportByParams function but the reports seem not to render properly. It does work when i use the 'embedReportById' - function (which essentially also calls the 'embedReportByParams' - function).

I tried to follow this guide Embedding Reports in Jelly which refers to embeding reports via jelly.

i thought the usage would be essentially the same but even using the provded example does not display any chart. It also does not throw errors.

I generated the parameters for the function in the server script and use following call in the client controller:

 

var targetEl = $("#report-widget-container");
embedReportByParams(targetEl, c.data.reportParams);

 

Any help will be highly appreciated.

 

4 REPLIES 4

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi,

 

You can't use jQuery in client controller in the service portal widgets. About reports, have you tried the oob widget for showing reports on the portal (the one you need to active to get).

Link to Docs

//Göran

Agmal
Kilo Contributor

Thanks Göran,

 

I am already using the report widget and embeding reports by id is working just fine.

This report widget has a dependency to GlideV2ChartingIncludesSP.js which is not the same one as the one in the jquery article (GlideV2ChartingIncludes.js) but it seems like its using similar functions or atleast namings.

The Service Portal specific include also contains a embedReportByParams function but i cant get any data back from it except when using the report id parameter (then it will just embed the exisiting report).

 

In general it should be possible as its using the Highcharts dependency but if there is no way to generate custom reports on the fly i think this has to be done in a custom qay, utilizing the Highcharts library.

 

Thanks for your effort

 

//Agmal

lss123
Tera Contributor

I was able generate custom charts inside a custom widget using the HighCharts library.  I added a dependency on my widget to the script "scripts/glide-highcharts.js".  I originally tried doing the same with GlideV2ChartingIncludes.js and GlideV2ChartingIncludesSP.js but those didn't play nicely with the rest of the portal - it seemed to mess up other widgets.  But glide-highcharts.js worked wonderfully.

So all I did was create the dependency, then I built out my HighCharts just like any you see from the HighCharts website.

If anyone's interested as to how I found that, I created a test portal and put the out-of-box report widget on it.  Then I viewed it in Chrome and opened up the developer tools to look at what JavaScript files were included.  I found the ones below and from there it was trial and error until I could generate the custom chart and not have any other errors with any other widgets.

https://xxx.service-now.com/scripts/angular-truncate.js
https://xxx.service-now.com/scripts/glide-highcharts.js
https://xxx.service-now.com/scripts/GlideV2ChartingIncludesSP.js
https://xxx.service-now.com/scripts/js_includes_sp_libs.jsx
https://xxx.service-now.com/scripts/js_includes_sp.jsx

AshwinD1
Kilo Explorer

@Agmal , did you ever find solution to your stated problem. I have a similar requirement to use report widget and parameters to generate custom report. I was wondering if you could guide me on the same.