What is the best way to get gs.getUser().getDepartmentID() in a scoped script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 08:53 AM
I'm trying to set the default value of the department field on a scoped table and this doesn't seem to work since the scoped API is limited, is there a simpler way than a full GlideRecord query?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 09:01 AM
Well try this
gs.getUser().getRecord().getValue('department');
Note: getRecord() does not return GlideRecord, it returns GlideMemoryRecord which is a cached version of GlideRecord.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 10:55 AM
I tried that and it gave me an error that getRecord() wasn't allowed in a scoped app.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 09:09 AM
I've sent this thread off to our platform business unit. Personally, I think it's sad that gs.getUser().getDepartmentID() doesn't work in a scoped app.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 10:55 AM
Thanks Chuck, I agree. There isn't any reason I can think of that the getUser() is so limited in scoped apps.