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

User151789
Mega Contributor

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?

9 REPLIES 9

Abhinay Erra
Giga Sage

Well try this


gs.getUser().getRecord().getValue('department');



Note: getRecord() does not return GlideRecord, it returns GlideMemoryRecord which is a cached version of GlideRecord.


I tried that and it gave me an error that getRecord() wasn't allowed in a scoped app.


Chuck Tomasi
Tera Patron

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.


Thanks Chuck, I agree.   There isn't any reason I can think of that the getUser() is so limited in scoped apps.