- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 05:46 PM - edited 01-22-2024 05:57 PM
Howdy Community,
The below script returns User is [object GlideRecord] instead of a sys_id.
I can create log messages that verify the current.variables.n_user below.
The variable is of the string type from a single line text field.
`Tried adding .sys_id in various places, creating other variables that are dot walked, & getRefRecord.
But, log messages reveal value is [object GlideRecord] instead of a sys_id.
Any ideas how to make this work?
var rqstdFor = current.variables.n_user;
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',rqstdFor.sys_id);
gr.query();
gs.addInfoMessage('User is '+gr);
Also tried
var rqstdFor = current.variables.n_user;
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',rqstdFor);
gr.query();
gs.addInfoMessage('User is '+gr);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 06:10 PM
Hi @Lon Landry4
if you refer to your code line:
gs.addInfoMessage('User is '+gr);
then yes, the output is correct as gr is an object.
You have to change it to
gs.addInfoMessage('User is '+gr.getValue('sys_id'));
if you want to see any sys_id
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 06:10 PM
Hi @Lon Landry4
if you refer to your code line:
gs.addInfoMessage('User is '+gr);
then yes, the output is correct as gr is an object.
You have to change it to
gs.addInfoMessage('User is '+gr.getValue('sys_id'));
if you want to see any sys_id
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 06:41 PM
Thank you! I have been at this six 6am us central time.