Add UI Page to Dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 08:59 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 05:37 AM
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.
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:
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.
Widget
Objective: add the UI Page to a widget to be used in a dashboard.
Dashboard
Now the widget is available and can be added to a dashboard: