Adding custom widgets

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2011 10:51 AM
I am working on a custom homepage for my department, and I would like to add a custom weather widget. I can google this and find more than one place to set one up and obtain the html code that I need. the problem I am running into is where do I put this code? I tried creating a new widget and pasting the code in the 'script' section, but it didn't work.
Thanks for the help - as always.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2011 11:38 AM
Here's an article that explains it, but you'll basically want to create a UI Page with the html code and then reference the UI Page from the widget.
http://wiki.service-now.com/index.php?title=Creating_a_Custom_Homepage_Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2011 11:45 AM
You will want to look at the other widgets under System UI -> Widgets. The script is actually JavaScript, and must have the methods "sections" and "render."
What you will want to do is put your HTML code in a UI page, and say you title it "weather_widget." Then your Widget code (in the script section of the actual Widget) can look like this:
function sections() {
return {
'San Diego Weather' : { 'type' : 'weather', zip: '92130' }
};
}
function render() {
var gf = new GlideForm(renderer.getGC(), "weather_widget", 0);
gf.setDirect(true);
gf.setRenderProperties(renderer.getRenderProperties());
return gf.getRenderedPage();
}
function getEditLink() {
return '';
}
The key is that the sections returns an object, where each key is the Title of the actual widget, and the settings are inside. You can access any of those properties in Jelly later by putting something like ${RP.getWindowProperties().get('zip')}, in case you wanted to show a different ZIP code for each user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 10:31 AM
HI Tyler
I have a two similar requirement like this
1.create hyper link in service portal for more information click here tried this with catalog variable like this
In the variables, simply enable the help text and enter the html code like below
Look in Service Portal
this works for me but i need the same thing with out any variable can pls suggest best solution if possible pls provide suitable code
2. Add a VIP icon for vip users in service portal similar to incident caller
Inputs are appriciated
Thanks and Regards
Venkatesh