- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2023 01:02 PM - edited 02-21-2023 06:58 PM
I have a UI page that generates a report referring to the Incident table. This UI Page is supposed to summarize several fields in the incident form but at any given time, these fields may not necessarily be filled in. The ask is that if the field does not have a value, it needs to be removed from the report. This report is built via HTML so I assume that Jelly scripting will be required, wondering if anyone can provide the basics on how that would work.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2023 07:48 AM - edited 02-26-2023 07:57 AM
Could u share more details a snippet of the code and explain what you need to do ?
So follow some example to hide an empty field on a UI Page using Jelly Script, you can use the <j:if> tag along with the <j:out> tag to conditionally display the field only if it has a value. Here's an example:
<j:if test="${empty myField}">
<!-- myField is empty, so do not display it -->
<j:out value=""/>
</j:if>
<j:if test="${not empty myField}">
<!-- myField has a value, so display it -->
<j:out value="${myField}"/>
</j:if>
In the example above, replace myField with the name of the field you want to conditionally hide based on its value.
The <j:out> tag is used to output the value of a variable or expression, and setting its value to an empty string "" effectively hides the field from the UI.
The first <j:if> block checks if the myField variable is empty, and if it is, it outputs an empty string. The second <j:if> block checks if the myField variable is not empty, and if it is not, it outputs the value of the myField variable.
Note that this example assumes that myField is a variable that has been defined somewhere in your Jelly Script code. If myField is a field on a record in ServiceNow, you will need to use the appropriate GlideRecord API to retrieve its value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2023 08:08 AM
The report is displaying a summary of the record in <fieldname>|<value> format in a table row.
If the field has no value, I don't want to show it in the report.
Here is the screenshot of one of the many fields in question:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2023 07:48 AM - edited 02-26-2023 07:57 AM
Could u share more details a snippet of the code and explain what you need to do ?
So follow some example to hide an empty field on a UI Page using Jelly Script, you can use the <j:if> tag along with the <j:out> tag to conditionally display the field only if it has a value. Here's an example:
<j:if test="${empty myField}">
<!-- myField is empty, so do not display it -->
<j:out value=""/>
</j:if>
<j:if test="${not empty myField}">
<!-- myField has a value, so display it -->
<j:out value="${myField}"/>
</j:if>
In the example above, replace myField with the name of the field you want to conditionally hide based on its value.
The <j:out> tag is used to output the value of a variable or expression, and setting its value to an empty string "" effectively hides the field from the UI.
The first <j:if> block checks if the myField variable is empty, and if it is, it outputs an empty string. The second <j:if> block checks if the myField variable is not empty, and if it is not, it outputs the value of the myField variable.
Note that this example assumes that myField is a variable that has been defined somewhere in your Jelly Script code. If myField is a field on a record in ServiceNow, you will need to use the appropriate GlideRecord API to retrieve its value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 04:03 PM
Thanks for this, looking at the existing code now, there are a ton of <j:if> tags all over the XML of which I had no idea how it worked. I am using those tags to wrap around the <tr> entries and it is working like a charm.