getvalue of Short Field Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2019 08:34 AM
I am trying to get value form "Field Name" on one of the audit tables.
these Field Name fields have a type of short field name.
var rs2 = new GlideRecord("sys_audit");
rs2.addQuery("documentkey", data.sys_id.toString());
rs2.addQuery("tablename", data.table.toString());
rs2.addQuery("fieldname", "IN", fieldTypes.join(","));
rs2.orderByDesc("sys_created_on");
rs2.query();
while (rs2.next())
{
var fl = rs2.fieldname.getDisplayValue();
both getvalue and getdisplay value are returning the system name rather than the friendly name.
What I mean by this is, it is returning "reopened_by" instead of "Last Reopened By"
Any idea how I get the latter?
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2019 08:37 AM
Hi there,
Have you tried gr[fieldName].getLabel();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2019 08:54 AM
Hi Mark
That returns "Field Name" as in the the column name which is Field Name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2019 08:59 AM
Ah oke, I misunderstood.
I would think .getDisplayValue() should work fine. I have to test.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2019 09:05 AM
Looks to be working fine here 😞
var gr = new GlideRecord('sys_audit');
if(gr.get('a4e16233db0333005c4c9ce8db9619d0')) {
gs.info(gr.fieldname.getDisplayValue());
}
This gives met the expected choice label instead of the value.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field