Custom dashboard widget development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 01:53 AM
I have been trying to create custom widget to be added on Dashboard. I found a way to achieve the goal with limited customization option here.
https://docs.servicenow.com/bundle/helsinki-platform-user-interface/page/script/server-scripting/task/t_UsingUIPagesAsGauges.html
I looked into other System UI > Widget with render type = JavaScript definitions the technique used there are more suited to Global scope.
The community post suggests me that portal widget can not be used in dashboard, I believe there is no alternative?
When followed "Create a widget that displays a ServiceNow UI Page" steps, it throws following warning, however the page does gets rendered. Since the page is no longer available in later release, it might be deprecated
org.mozilla.javascript.EcmaError: Cannot find function getProperty in object com.glide.script.fencing.ScopedGlideSession@1b8fcfc.
Caused by error in sys_widgets.cb3d0c76db4f73002793797b8c961938.script
Does anyone know how to create custom widgets that can be used in dashboards?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 01:59 AM
Check this
https://community.servicenow.com/community?id=community_article&sys_id=c48db33ddb356700107d5583ca9619a5
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 12:34 AM
Hello Harish,
On the link you provided it works for global scope however for scoped application the line with
return renderer.getRenderedPage(name);
throws error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2021 01:35 AM
Hey
I am running into the same problem , do you get to know how to work it out for scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2022 03:07 AM
Hi
I was also stuck with the same issue.
Here are my findings.
Issue: Following method is not available in scoped app
return renderer.getPreferences().get("uiPageName");
For UI page in scoped app use following:
To get page name use
var uiPageName = renderer.getPreference("uiPageName");
To render
return renderer.getRenderedPage(scope+uipagename);
you can get scope as follows
var scope = gs.getCurrentScopeName();
Disclaimer
renderer.getPreference("uiPageName");
//returns page name with space in between (if camel case)
eg:Page name "WeatherData" will appear as "Weather Data".
Please refer the following
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0754978
It is working for me.
Please mark helpful.