Add UI Page to Dashboard

Rocky5
Kilo Sage

Hello Experts,

 

I want to add a UI page to the dashboard.. and I found the below script in the docs.servicenow. And I have created a widget with name as 'Velocity History' and I want to call a ui page '$scrum_velocity_history_chart' . what all should I modify in the below servicenow provided script? where should I provide the ui page name that I want to call.

The UI Page I want to call is under 'Performance Analytics Content Pack for Agile 2.0' application scope.

 

function sections() {
    return {
    'Widget': {
    'type': 'widgetname'
    }
    };
}

function render() {
    var scope = gs.getCurrentScopeName();
    scope = (scope == "rhino.global" ? "" : scope + "_");
    var page = renderer.getPreference('type');
    return renderer.getRenderedPage(scope + page);
}

function getEditLink() {
    var scope = gs.getCurrentScopeName();
    scope = (scope == "rhino.global" ? "" : scope + "_");
    var page = renderer.getPreference('type');
    return "sys_ui_page.do?sysparm_query=name=" + scope + page;
}

Thanks,

Rocky.

1 REPLY 1

ArTex
Tera Contributor

How to open a UI page in a Widget to be added to a dashboard

Sometimes there are highly customized requirements that request the return of values/variables not part of a table, and as a result, we cannot use them in a report with the OOTB functionalities provided by ServiceNow.

 

In the example I will demonstrate, I need a report with the sum of the sponsoring fees per year. These values are obtained through a script include and do not belong to any variable in the “Sponsoring” table.

Visualization of the sponsoring fee per year in two records, calculated based on three variables from the table (start, end, and fee). The table was generated through a UI macro added to a formatter.

ArTex_0-1743769772434.png

Problem: How can I use the data generated for all records to create a report with the sum of the sponsoring fees per year?

 

Solution: Create a UI page to generate the table with the results of the sum of the sponsoring fees per year, and add it to a widget to be displayed on a dashboard.

 

Result:

ArTex_2-1743769972272.png

 

Development:

UI Page

Objective: create a list/table with the records of the sum of all fees per year.

Note: Other ways to visualize the data can be created, for example, through charts.

ArTex_3-1743770039101.png

Widget

Objective: add the UI Page to a widget to be used in a dashboard.

ArTex_4-1743770113236.png

Dashboard

Now the widget is available and can be added to a dashboard:

ArTex_5-1743770154898.png