- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 02:51 AM
I've created UI page to display record of incident table. But am not getting the values of state & short description fields.
Here is the code:
<tr>
<td> ${gr.number}</td>
<td> ${gr.caller_id.getDisplayValue()} </td>
<td> ${gr.category} </td>
<td> ${state.getDisplayValue()} </td>
<td> ${short_description.getDisplayValue()} </td>
</tr>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 08:17 AM
Ok, I had to mess around with it a bit, but this is working for me:
First UI Page:
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Start Date:<g:ui_date name="start_date" id="start_date" table="incident" field='sys_created_on'/> <br/><br/>
End Date:<g:ui_date name="end_date" table="incident" field='sys_created_on'/>
<br/>
<br/>
<button onClick = "MyFunction()"> Ok </button>
<button onClick = "MyFunction2()"> Cancel </button>
</j:jelly>
Client script:
function MyFunction(){
var date1 = gel("start_date").value;
var date2 = gel("end_date").value;
var nums = '';
var gr = new GlideRecord('incident');
gr.addQuery('sys_created_on','>=',date1);
gr.addQuery('sys_created_on','<=',date2);
gr.query();
while(gr.next()){
nums += ',' + gr.getValue('number');
}
window.open("date_range_selected_incident.do?sysparm_nums="+nums);
}
function MyFunction2(){
window.open("Date_Range_selecting_incident",target="_self");
}
Second UI page:
<?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>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 50%;
}
tr, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
</style>
<body>
<table>
<tr>
<th>Incident Number </th>
<<th> Caller </th>
<th> Opened </th>
<th> Opened by </th>
<th> Assigned to</th>
<th> Priority</th>
<th> State </th>
<th> Short Description </th>
</tr>
<g2:evaluate var="jvar_incident" jelly="true" object="true">
var inc = new GlideRecord('incident');
inc.addQuery('number','IN',jelly.sysparm_nums);
inc.query();
</g2:evaluate>
<j2:while test="$[inc.next()]">
<tr>
<j2:set var="jvar_num" value="$[inc.number]"/>
<j2:set var="jvar_caller" value="$[inc.caller_id.getDisplayValue()]"/>
<j2:set var="jvar_opened" value="$[inc.opened_at.getDisplayValue()]"/>
<j2:set var="jvar_openedby" value="$[inc.opened_by.getDisplayValue()]"/>
<j2:set var="jvar_assigned" value="$[inc.assigned_to.getDisplayValue()]"/>
<j2:set var="jvar_priority" value="$[inc.priority.getDisplayValue()]"/>
<j2:set var="jvar_state" value="$[inc.state.getDisplayValue()]"/>
<j2:set var="jvar_short" value="$[inc.short_description]"/>
<td> $[jvar_num]</td>
<td> $[jvar_caller] </td>
<td> $[jvar_opened] </td>
<td> $[jvar_openedby] </td>
<td> $[jvar_assigned] </td>
<td> $[jvar_priority]</td>
<td> $[jvar_state]</td>
<td> $[jvar_short]</td>
</tr>
</j2:while>
</table>
</body>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 08:17 AM
Ok, I had to mess around with it a bit, but this is working for me:
First UI Page:
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Start Date:<g:ui_date name="start_date" id="start_date" table="incident" field='sys_created_on'/> <br/><br/>
End Date:<g:ui_date name="end_date" table="incident" field='sys_created_on'/>
<br/>
<br/>
<button onClick = "MyFunction()"> Ok </button>
<button onClick = "MyFunction2()"> Cancel </button>
</j:jelly>
Client script:
function MyFunction(){
var date1 = gel("start_date").value;
var date2 = gel("end_date").value;
var nums = '';
var gr = new GlideRecord('incident');
gr.addQuery('sys_created_on','>=',date1);
gr.addQuery('sys_created_on','<=',date2);
gr.query();
while(gr.next()){
nums += ',' + gr.getValue('number');
}
window.open("date_range_selected_incident.do?sysparm_nums="+nums);
}
function MyFunction2(){
window.open("Date_Range_selecting_incident",target="_self");
}
Second UI page:
<?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>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 50%;
}
tr, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
</style>
<body>
<table>
<tr>
<th>Incident Number </th>
<<th> Caller </th>
<th> Opened </th>
<th> Opened by </th>
<th> Assigned to</th>
<th> Priority</th>
<th> State </th>
<th> Short Description </th>
</tr>
<g2:evaluate var="jvar_incident" jelly="true" object="true">
var inc = new GlideRecord('incident');
inc.addQuery('number','IN',jelly.sysparm_nums);
inc.query();
</g2:evaluate>
<j2:while test="$[inc.next()]">
<tr>
<j2:set var="jvar_num" value="$[inc.number]"/>
<j2:set var="jvar_caller" value="$[inc.caller_id.getDisplayValue()]"/>
<j2:set var="jvar_opened" value="$[inc.opened_at.getDisplayValue()]"/>
<j2:set var="jvar_openedby" value="$[inc.opened_by.getDisplayValue()]"/>
<j2:set var="jvar_assigned" value="$[inc.assigned_to.getDisplayValue()]"/>
<j2:set var="jvar_priority" value="$[inc.priority.getDisplayValue()]"/>
<j2:set var="jvar_state" value="$[inc.state.getDisplayValue()]"/>
<j2:set var="jvar_short" value="$[inc.short_description]"/>
<td> $[jvar_num]</td>
<td> $[jvar_caller] </td>
<td> $[jvar_opened] </td>
<td> $[jvar_openedby] </td>
<td> $[jvar_assigned] </td>
<td> $[jvar_priority]</td>
<td> $[jvar_state]</td>
<td> $[jvar_short]</td>
</tr>
</j2:while>
</table>
</body>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 12:13 AM
Hi Kristen Ankey,
Thank you so much.
Its working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 03:08 AM
Hi,
I need row count for multiple records.
am using gr.getRowCount() after loop, but the window.open() function is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 06:20 AM
Hi Haritha,
Do you want to display the row count on the second UI page or the first? Keep in mind, if the first, then it will probably pop up briefly and then disappear.
I'm glad the code worked - would you be able to mark my answer correct? Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 07:21 AM
Hi,
Count in second UI page.
I've written inc.getRowCount(); in <j2:while> loop
but its displaying inc.getRowCount(); as a value based on number of records.