- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 10:46 AM
I need to read a value from a table whose one of the columns is a reserved word - new, but when I try to do this, I get a Javascript error:
This is a snipped of my script:
while(gr.next()) {
description += gr.new+'\r\n';
}
But I get Warning when I click on the "verify syntax" button and since this is jut a Warning, I ignore it, save the script and let it run, but when it runs, it throws the following exception:
Execption in Activity Handler:Log Object
Object
lineNumber: string = 52
sourceName: string = <refname>#17(eval)
name: string = SyntaxError
message: string = missing name after . operator
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 11:11 AM
Hi Ricardo,
You can either use the GlideRecord methods getValue or getDisplayValue depending on the field type.
Using the getValue method, your example code would become:
while (gr.next()) {
description += gr.getValue('new') + '\r\n';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 11:02 AM
I think it is _new. So, gr._new.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 11:11 AM
Hi Ricardo,
You can either use the GlideRecord methods getValue or getDisplayValue depending on the field type.
Using the getValue method, your example code would become:
while (gr.next()) {
description += gr.getValue('new') + '\r\n';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2021 05:57 PM
When a field name is a reserved word in JavaScript, use bracket notation instead of dot walking to reference it. Change the statement inside the while loop to this:
description += gr['new']+'\r\n';