querying a gliderecord within a gliderecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017 01:50 PM
Hi Experts,
We are trying to query HR Profile for a user's manager and then re-query HR Profile to get details regarding the manager and are stuck on the syntax. Below is the current code in place:
var my_profile = new GlideRecord('sn_hr_core_profile');
my_profile.addQuery('user', sys_user);
my_profile.query();
while (my_profile.next()) {
var mgr2 = my_profile.user.manager.getRefRecord();
var mgr = mgr2.getValue('sys_id');
var my_manager = GlideRecord('sn_hr_core_profile');
my_manager.addQuery('user', mgr);
my_manager.query();
while (my_manager.next()) {
data.manager = my_manager.getDisplayValue('user');
data.manager_email = my_manager.getDisplayValue('user.email');
data.manager_phone_business = my_manager.getDisplayValue('user.phone');
data.manager_phone_mobile = my_manager.getDisplayValue('user.mobile_phone');
data.manager_phone_home = my_manager.getDisplayValue('user.home_phone');
data.manager_position = my_manager.getDisplayValue('position');
data.manager_grade = my_manager.getDisplayValue('x_salary_grade');
data.manager_eri= my_manager.getDisplayValue('x_eri);
}
Service Portal does not like the highlighted blue line and we keep getting the error: Server JavaScript error Method "ScopedGlideRecord" called on incompatible object.
I don't think it likes the fact that "new" isn't in front of GlideRecord, but even when we do put new in that line, the widget shows up blank. How do we fix that line so that our widget works? The above code worked perfectly in Helsinki, but now that we're in Istanbul, we're running into this issue...
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2017 08:56 PM
Once you have my_profile, why not just dot-walk to user.manager.whatever?