- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 07:49 AM
Hi all,
I am facing a weird issue (or maybe I am wrong).
I am trying to run a simple background script to retrieve field values from the tables Asset and Hardware (lets say for example install_status), but the system always return the value "undefined".
Here is my script :
var myQuery = 'u_configurationLIKE_MANUEL';
var gr = new GlideRecord("alm_asset");
gr.addEncodedQuery(myQuery);
gr.query();
gs.print('count :'+ gr.getRowCount());
if (gr.next()) {
gs.print("status: "+ gr.install_status);
}
The first "gs.print" returns 23 (what is expected) but the second returns undefined.
If I replace install_status by sys_id, it works fine !!
If I take any other field I always get "undefined" value.
I thought maybe it's due to an ACL, but when I have a look to the Asset list I can see all the fields which confirms that it's not due to an ACL issue.
If I run a similar query for any other table, it works fine.
Any idea guys ? is it something specific to Asset management ?
Thank you in advance
Best regards,
Hamza
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 09:53 AM
The solution is very very simple !!!
Simply do not use "gr" as a variable name in a GlideRecord !!
Thank you guys for your help !!
Best regards,
Hamza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 08:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 08:40 AM
After reading through this, it sounds like something was added to this instance that is not there by default. Hamza, maybe you can review customizations made to the environment in Asset? (in addition to contacting customer support).
Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 09:53 AM
The solution is very very simple !!!
Simply do not use "gr" as a variable name in a GlideRecord !!
Thank you guys for your help !!
Best regards,
Hamza

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 09:59 AM
You were running in to a variable scope issue? Really? Well, I'm glad you got it worked out.
Shame on me, I forgot to wrap that in the anonymous function and this wouldn't have been issue.
(function () {
// all that cool code here
})();
Next time...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 10:00 AM
Lesson learnt