Call reports in UI page

Community Alums
Not applicable

Hi,

In embedReportById(targetSpan, reportId, additionalFilter) API given by service now additionalFilter is

not working.

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ganesh,



If you want to include the report in an ui page first of all you will have to create a gauge from that report.


You can then use a iframe tag in the ui page with src attribute as the url for the gauge


refer this for more help UI page - Gauge - Report



Mark my reply as Correct and also hit Like and Helpful if you find my response worthy.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Community Alums
Not applicable

Hi Ankur,



Thanks for the reply.



I have created UI page with following code.



<?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:requires name="scripts/GlideV2ChartingIncludes.js" includes="true"/>


        <div id="report_stuff"/>


  <script>


  var additionalFilter = 'priority=1';


  var div = $j("#report_stuff");


embedReportById(div,'d028d98f470111002ee987e8dee49097',additionalFilter);


  </script>


</j:jelly>



In the above code I have "embedReportById(div,'d028d98f470111002ee987e8dee49097',additionalFilter);" in this I am calling a report by using a sys id and I want to pass the filter to report based on user input. So 'additionalFilter' is the parameter for this API. I am able to call report but unable to set the filter based on user input.



Please see the below Service Now URL.


Embedding reports in Jelly



I am just following the steps mentioned over here.



Once I got report, Then I can call it on homepage by creating widget.



Thanks,


Ganesh


Hi Ganesh,



The second parameter for the embedReportById is additional parameters. If you want to use some filter then you need to use the parameter 'sysparm_query'


Just try to use this code


embedReportById(div,'d028d98f470111002ee987e8dee49097','sysparm_query='+additionalFilter);



Mark my reply as Correct and also hit Like and Helpful if you find my response worthy.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Sorry it's the third parameter.



Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader