Publish a UI page in a dashboard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2017 11:53 PM
Hi!
I'm trying to publish a UI Page as a Widget on a dashboard.
I'm getting;
Security constraints prevent access to requested page
Its a simple UI page writing out Hello World on the screen.
No JavaScript no nothing.
The code for the widget;
function sections() {
return {
'widget_name': { 'uiPageName' : 'hello_world'},
};
}
function render() {
var uiPageName = renderer.getPreferences().get("uiPageName");
return renderer.getRenderedPage(uiPageName);
}
function getEditLink() {
return "sys_ui_page.do?sysparm_query=name=" + renderer.getPreferences().get("uiPageName");
}
I have given the widget one of out public roles, and I'm running this with full admin.
What am I missing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2017 02:12 AM
The code that you are using works prior to fuji.
This code works with the scoped API and applies to custom and global applications on Fuji or later versions.
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;
}
Check section 2 in the below page:
Using UI Pages as Gauges - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2017 05:46 AM
Thanks...
But there was more to this than just the code, apparently you can't use "_" [under score] in the UI Page name as well.
I realized that the code was a bit old pretty early.
But the underscore problem took me a while to figure out!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 07:18 PM
This was helpful, thank you. My UI Page is now showing as a widget correctly in my dashboard. I don't know why SNOW doesn't have this documented for how to use with a scoped application. Maybe it is documented and I just cannot find it. The only SNOW documentation they have doesn't not mention scoped application at all. Also, the link you provided doesn't seem to have a section 2 nor solution for scoped application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 09:34 AM
Hi
Thanks