type of gr.active
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 08:56 AM
Hello Folks,
can any body clear me on this ...
var gr = new GlideRecord('sys_user');
gr.get('user_name', 'XXX');
1) gs.print(typeof gr)
2) gs.print(typeof gr.active);
both are object type ...what is the difference between object-1 and object-2
I could get all the properties of all the object-1 , where as I could not in object-2.
Also ----> gs.print(gr.active == true) <------------> gs.print(gr.getValue('active') == true)---------->gs.print(gr.getValue('active') == 'true')
can any body please make me understand above statements.
- Labels:
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2019 12:50 AM
Servicenow behaves here in a different way Rahul.
Let me tear up the answers for your questions :
var gr = new GlideRecord('sys_user');
gr.get('user_name', 'XXX');
1) gs.print(typeof gr)
2) gs.print(typeof gr.active);
both are object type ...what is the difference between object-1 and object-2
Yes, Both are object Type. The difference between Object 1 and Object 2 is Object 1 is the GlideRecord Object where as the object 2 is Glide Element Object , so the typeof returns the object
The getValue() method on the GlideRecord object return value is string so what it internally does is it picks the primitive value from that glideelement object returned
Hope this helps
Mark this response as correct if that really helps
Thanks,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2019 07:15 AM
var gr = new GlideRecord('sys_user');
gr.get('user_name', 'admin');
gs.print(gr.active == true);//--->true
gs.print(gr.getValue('active')==true)//---->true
gs.print(typeof gr.getValue('active') )//-->string
gs.print(typeof 'true' )//-->string
gs.print(gr.getValue('active')=='true')//---->false--> I am confused with this ..can you please explain thist.
Also , what is the difference between GR object and GE object ....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2019 07:29 PM
GlideRecord object contains each individual field information on the table as a single GlideElement Object and gr.field_name retrieves the information from this GlideElement Object only.
Refer the image below for a reference
In this way each field will be of a GlideElement Object
Hope this helps
Mark this response as correct/helpful if that really helps
Thanks,
Siva