Getting Values from GlideRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 01:48 PM
I'm fairly new to Jelly and the ServiceNow platform in general. I'm trying to build a UI Page and I have the shell of my HTML built but I'm having some trouble accessing the values in the GlideRecord. I have this code in place:
<g:evaluate var="jvar_cmg_io" object="true" jelly="true">
var io = new GlideRecord('x_cmgrs_digital_io_intake');
io.addQuery('status', 'Open');
io.addQuery('number', 'ORD0002455');
io.query();
</g:evaluate>
Then, later when I try to output the Order Number for instance, I'm not getting any output.
<strong>Order Number:</strong> ${ jvar_cmg_io.number }
Any help would be much appreciated. Thanks.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 02:11 PM
Hi Ryan,
Try this out:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_cmg_io" object="true" jelly="true">
var io = new GlideRecord('x_cmgrs_digital_io_intake');
io.addQuery('status', 'Open');
io.addQuery('number', 'ORD0002455');
io.query();
</g:evaluate>
<j:while test="${jvar_cmg_io.next()}">
<p>Order Number:<strong> ${HTML:jvar_cmg_io.getValue('number')}</strong></p>
</j:while>
</j:jelly>
Hope this help!
-Manjul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 02:33 PM
Hi Manjul,
Thanks for your quick response. Unfortunately, that didn't work either.
I'm pretty sure I'm referencing the correct table, but not sure if I'm querying the table correctly. How can I make sure I'm passing the correct variables to the query?
Just FYI - I hard-coded the value of the 'number' field for testing purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 02:38 PM
Not a problem, lets try this first :
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_cmg_io" object="true" jelly="true">
var io = new GlideRecord('x_cmgrs_digital_io_intake');
io.query();
io;
</g:evaluate>
<j:while test="${jvar_cmg_io.next()}">
<p>Order Number:<strong> ${HTML:jvar_cmg_io.getValue('number')}</strong></p>
</j:while>
</j:jelly>
if above code works, then we can deal with queries as a next thing.
-Manjul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 02:56 PM
That didn't work either, so does that mean I'm not querying the correct table? I got the table name by going into an instance of a test form, clicking on the "Hamburger Icon", going to "Configure" and "Table". The value in the "Name" field is 'x_cmgrs_digital_io_intake'.