February 2018
Intermediate to advanced
226 pages
5h 13m
English
The if tag in Jelly script works in a similar way to a JavaScript if statement. It is used to run code if a set condition is met. As we can set if statements in JavaScript, whether you want to use the Jelly if rather than the JavaScript if is up to you.
We can use the if tag to check whether a GlideRecord object has any records inside it. Let's have a look at how this is done using our example from the evaluate tag:
<g2:evaluate var="jvar_onHoldIncidents" object="true" jelly="true"> var holdIncident = new GlideRecord('incident'); holdIncident.addQuery('state', jelly.jvar_onHoldState); holdIncident.query(); holdIncident;</g2:evaluate><j:if test="${!jvar_onHoldIncidents.hasNext()}"> No on hold incidents.</j:if><j:if test="${jvar_onHoldIncidents.next()}"> ...Read now
Unlock full access