Jelly in ServiceNow UI – 101

Jelly in ServiceNow UI – 101


Well, Jelly is a tool for turning XML into executable code. It is a Java and XML based scripting and processing engine. ServiceNow uses Jelly to render web pages. ServiceNow actually has enhanced it to add even more capabilities.

So, Question arise, Why Jelly, why not just plain simple HTML?

Jelly produces HTML by interpreting a Jelly template (JT), which is itself an XML document. JT has their own set of XML tags and syntax, but they also directly incorporate the HTML tags that will be produced as output. These special tags do all the fancy stuff, including things that looks like more conventional programming language, the ability to use data from ServiceNow, ways to execute JavaScript.

jelly high level

This is shown graphically at above (click to enlarge diagram). Whole process works like this, conceptually (don’t worry about details at this moment):

  1. Request: A web browser sends a request to ServiceNow instance. URL is for a web page that will be rendered with Jelly (not all ServiceNow URLs result in using it, though most do).
  2. Jelly template selection: ServiceNow instance uses particulars in URL for request to select right JT to use for rendering that particular page.
  3. Jelly interpretation: Jelly engine is invoked with selected template, and template is processed to produce output HTML. There are many details about this process that we’ll cover in later posts. For now, just note that engine can access data from ServiceNow instance, and use that data either as content in output, or to make decisions about what to output.
  4. Response: The output HTML is transmitted back to requesting web browser.

Write this to UI Page XML code:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
var letters=["Hi","My","Jelly"];
<j:forEach var="jvar_letters" items="${letters}">

Hit “Try it” button and see output.

Stay tune for more….


  • XXX says:

    September 4, 2017 at 8:23 pm

    Where can I find “try it” button ??

    • ccc says:

      September 4, 2017 at 8:24 pm

      There is no try it button

Leave a reply

Your email is never published nor shared. Required fields are marked *

Are you Human? * Time limit is exhausted. Please reload CAPTCHA.

Pin It on Pinterest

Share This