
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 06:52 AM
Hi All,
I am stuck at a point to complete my task, please guide me on this.
I am trying to display all those incidents in a UI Page whose creation date is less than or equal to date selected in my new customized field 'incident_date' on my current incident.
For this I have created a UI action on my incident form which is calling the UI Page. For the sake of test to my approach I tried pulling data with query of all the active=true incident and it working fine.
But when I add query for date comparison it is showing me error and the reason is not known to me.
I am adding the code which is giving me error.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<style>
th, td {
padding: 5px;
}
</style>
<j:set var="jvar_incidet_date" value = "${sysparm_incident_date}" />
<g:evaluate var="jvar_incident" object="true">
var gr = new GlideRecord('u_my_incidents');
gr.addQuery('active', 'true');
gr.addQuery('created_on','<=','${jvar_incidet_date}'); ---> error
gr.query();
gr;
</g:evaluate>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 07:49 AM
Completely forgot you need to escape the <= in xml. Try this line instead and make sure that your jelly.jvar_incident_date is not in quotes.
gr.addQuery('sys_created_on', '<=', jelly.jvar_incident_date);
Also, you need to make sure to include the jelly attribute:
<g:evaluate var="jvar_incident" object="true" jelly="true">

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 06:56 AM
The created field is actually named sys_created_on, so I would start by switching that name out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 07:03 AM
Hello Brad,
Thanks for that prompt response.
I followed your suggestion but there is some kind of syntax error in the line I highlighted above.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 07:07 AM
Ahh yes, you don't need to use jexl notation inside the g:evaluate block. Take a look at the text in italics.
<g:evaluate var="jvar_incident" object="true" jelly="true"> //add the jelly parameter
var gr = new GlideRecord('u_my_incidents');
gr.addQuery('active', 'true');
gr.addQuery('created_on','<=', jelly.jvar_incidet_date); //change here
gr.query();
gr;
</g:evaluate>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2014 07:17 AM