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-17-2015 08:17 AM
Makes sense. Thanks. I'll give that a try and let you know how it goes.
The major hang-up I'm having right now is getting the values from the fields that reference other tables. For example, when I right-click the "Digital Specialist Name" field, and click "show 'coordinator_name'" I get the following:
Dictionary Info: x_cmgrs_digital_io_intake.coordinator_name
Table: x_cmgrs_digital_io_intake
Element: coordinator_name
Type: reference
Reference: sys_user
I'm able to output the fields directly associated with the 'x_cmgrs_digital_io_intake' table. For example ${ io.campaign_start_date } and ${ io.campaign_end_date })
However, if I try to output ${ io.coordinator_name } I'm not getting a value and I think this has to do with the fact that it's a reference field. I've also tried ${ io.coordinator_name.sys_user }
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2015 09:10 AM
Hmm, I did a quick test on my developer instance using incident as the table in question. I then tested things like io.caller_id, io_caller_id.phone, io.caller_id.department.ui. They seemed to work fine. I also created a new table entirely, gave it a reference field to sys_user, and it still worked.
I also made a new application to see if it was a scope issue, but it looks okay there too.
Can you try with an out of the box table and see if you can output other reference fields there?