
- 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 07:20 AM
Could you post the most current code you're using?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2014 07:27 AM
<?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_incident_date" value = "${sysparm_incident_date}" />
<g:evaluate var="jvar_incident" object="true">
var gr = new GlideRecord('u_gsi_incidents');
gr.addQuery('active', 'true');
gr.addQuery('sys_created_on','<=','jelly.jvar_incident_date');
gr.query();
gr;
</g:evaluate>
<table>
<tr>
<th>Number</th>
<th> Short Description</th>
<th> Incident Date</th>
</tr>
<j:while test="${jvar_incident.next()}">
<tr>
<td>
${jvar_incident.getValue('number')}
</td>
<td>
${jvar_incident.getValue('short_description')}
</td>
<td>
${jvar_incident.getValue('u_incident_date')}
</td>
</tr>
</j:while>
</table>
</j:jelly>

- 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 11:43 AM
Thanks Brad!
Before posting this question I do tried with '<' but that dint gave me any result.
May be that was because I was missing to make jelly="true".
Anyhow it working now thanks again.
Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2015 03:54 AM
Thank Brad, you are a life saver