- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2015 07:51 AM
Hello there,
I am currently building a custom application with its own scope in the Fuji version. The problem that I encountered and couldn't deal with for quite some time now, is that it seems I can't access many methods of ScopedGlideRecord (I have tried even GlideRecord, with the same result). The context is, I'm trying to calculate a time duration according to the user's schedule in a before business rule, to populate a field before submitting.
This is the script I'm running:
function onBefore(current, previous) {
var currUserID = gs.getUserID();
var gr = new GlideRecord("sys_user");
var currUser = gr.get(currUserID);
var currSchedule = currUser.getValue('schedule');
//other logic
}
currUser is true, so the record is found. However all information I can get from it is the sys_id, which matches. If I turn on debugging and put the last statement into a try-catch block I get the following exception: Exception:: TypeError: undefined is not a function.
I'm currently really lost, all that I can think of is some kind of ACL which keeps me from accessing the values in the sys_user table from another scope.
I will be very thankful for any kind of suggestion.
Thank you very much!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2015 11:47 AM
Hi Filip,
GlideRecord get() function returns boolean value and not the reference. Could you try below lines of code and check if schedule is returned to you correctly.
var currUserID = gs.getUserID();
var currUser = new GlideRecord("sys_user");
currUser.get(currUserID);
var currSchedule = currUser.getValue('schedule');
Thanks,
Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2015 11:47 AM
Hi Filip,
GlideRecord get() function returns boolean value and not the reference. Could you try below lines of code and check if schedule is returned to you correctly.
var currUserID = gs.getUserID();
var currUser = new GlideRecord("sys_user");
currUser.get(currUserID);
var currSchedule = currUser.getValue('schedule');
Thanks,
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2015 01:25 AM
Hello Mandar,
Indeed, this was exactly the cause of the problem. After all the problems I encountered when trying to code a scoped application (opposed to global ones) I literally forgot how to use a GlideRecord.
Thank you very much for your quick reply!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2015 02:51 AM
Glad that it helped..
-Mandar