Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

World Clock widget issue.

Sanket Hardikar
Tera Contributor

I am trying to add World clock to contents pane. But getting 'Page not found' error. Can you please guide.

find_real_file.png

6 REPLIES 6

Mike Patel
Tera Sage

go to sys_ui_page.list and search for example_cool_clock 

It should have below code

<j:if test="${RP.isPreview()}">
 <center>No preview available</center>
</j:if>

<j:if test="${!RP.isPreview()}">
  <g:include_script src="scripts/excanvas.js"/>
  <g:include_script src="CoolClock.jsdbx"/>

  <!-- works on IE, but draws different -->
  <table><tr>
    <td align="center"><div><canvas id="x1" class="CoolClock:swissRail:30::-8 leftRightPad"></canvas></div>San Diego</td>
    <td align="center"><div><canvas id="x2" class="CoolClock::30:noSeconds:-5 leftRightPad"></canvas></div>New York</td>
    <td align="center"><div><canvas id="x3" class="CoolClock::30:noSeconds:+0 leftRightPad"></canvas></div>London</td>
    <td align="center"><div><canvas id="x4" class="CoolClock:swissRailPM:30:noSeconds:+2 leftRightPad"></canvas></div>Kiev</td>
  </tr></table>
</j:if>

Hi Mike,

 

I see the mentioned script under sys_ui_page.list>'My Clock Widget'. Still I am not able to get the reason for the issue.

Harsh Vardhan
Giga Patron

are you adding it on homepage ? if yes then it should not be the issue, i tried on my pdi and i am able to add that. 

 

World clock is widget actually and in the widget they have called "example_cool_clock" ui page. 

go to system UI >> Widgets >> search for "World Clocks".

 

"World Clocks" widget script:

 

function sections() {
    return {
      'World Clocks' : { 'name' : 'example_cool_clock' }
    };
}

function render() {
  var name = renderer.getPreferences().get("name")
  var gf = new GlideForm(renderer.getGC(), name, 0);
  gf.setDirect(true);
  gf.setRenderProperties(renderer.getRenderProperties());
  return gf.getRenderedPage();
}

function getEditLink() {
  if (!gs.hasRole('admin'))
     return '';

  return "sys_ui_page.do?sysparm_query=name=" + renderer.getPreferences().get("name");
}

rrataj
Kilo Expert

You might have removed or renamed the example widget

try to upload the 2 ootb XML's and check again