
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 08:13 AM
I am trying to return the string of the queried group with the following code, but it always returns NULL. If I change the getValue('name') to getRowCount(), then it returns 1, showing that the query itself is working but the getValue is not. As well as using 'name', I also tried group, assignment_group, and assignment_group.name, but none of them worked either. I also tried getDisplayValue('name') and getElement('name'), but those did not work.
I am using the Widget Editor, and my entries are as follows:
Server Script
(function(){
var groups = new GlideRecord('sys_user_group');
groups.addQuery('name', 'Database Atlanta');
groups.query();
data.test = groups.getValue('name');
})();
HTML Template
<div class="info">
Groups Output: {{ data.test }}
</div>
Please, what do I need to change the .getValue('name') to in order to return the string value of the group's name?
Kind Regards,
Joseph
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 08:21 AM
try now
(function(){
var groups = new GlideRecord('sys_user_group');
groups.addQuery('name', 'Database Atlanta');
groups.query();
if(groups.next()){
data.test = groups.getValue('name');
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 08:40 AM
glad i helped you.
you can go though the doc link which i had shared in my response. it has explained very well
Hit my response as helpful as well. so i can get some points 😛

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 08:52 AM
Thanks, I'll look through it!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 08:23 AM
you need to use next() to iterate the record value.
refer the doc link for further details about glide record
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GlideRecord-next