- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 01:00 PM
Can some one give me the code for getting the logged in user department
I tried gs.getUser().getDepartmentID(); and getDepartmentID() none of them worked
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 07:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 01:12 PM
var gr=new GlideRecord('sys_user');
gr.addQuery('sys_id',gs.getUserId());
gr.query();
if(gr.next())
{
var department=gr.department.getDisplayValue();
gs.addInfoMessage(department);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 01:20 PM
Hello ARK thanks but
I am trying to pull the logged in user department and setting it to another table department value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 01:38 PM
Can you try like,
var gr=new GlideRecord('sys_user'); gr.get(gs.getUserId()); gr.department.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 01:42 PM
How to include in this ? this is what i use in the run script of the workflow
var obj=new GlideRecord("u_data");
obj.initialize();
obj.table='u_data';
obj.u_accepted_user=gs.getUserName();
obj.u_department= ??
obj.insert();