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 03:06 PM
Looking at your steps, table name seem to be correct, there is another way you can check through URL.
Just right click on the same form and select "Copy URL", your URL should have the same table name.
For example It should be : https://<InstanceName>.service-now.com/nav_to.do?uri=x_cmgrs_digital_io_intake.do?sys_id=<Example: d71f7935c0a8016700802b64c67c11c6&>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 03:10 PM
Yes, that's what I'm seeing for "Copy URL".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 03:16 PM
Interesting....lets try one more thing by just changing the table name and see if we get any result set.
We can rename x_cmgrs_digital_io_intake to incident and see if returns anything from incident table.
<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('incident');
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>
Hope this one would work!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 03:28 PM
Nothing returned that way either. I also tried changing the 'getValue' parameter to 'short_description'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 03:35 PM
Oops! This should actually work, its working fine on Fuji instance please refer this link: ServiceNow
To login just use "admin" as UserID & Pwd.