-
Notifications
You must be signed in to change notification settings - Fork 913
UserManagement #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UserManagement #1913
Changes from 4 commits
20e7fca
95258d4
7736cd6
c84594d
0c46a1f
5500d0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Filter Users by Department | ||
|
|
||
| Overview | ||
| This Script Include returns users whose department is the same as the currently logged-in user’s department. | ||
| It can be used to filter the Caller field or any user reference field to show only users from the same department. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var getSameDeptUsers = Class.create(); | ||
| getSameDeptUsers.prototype = { | ||
| initialize: function() {}, | ||
| getSameDept: function() { | ||
| var user = gs.getUser().getDepartmentID(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. var user is not a good name for the Department. Perhaps userDepartment? |
||
| var d = new GlideRecord('sys_user'); | ||
| d.addQuery('department', user); | ||
| d.query(); | ||
|
|
||
| var str = ""; | ||
| while (d.next()) { | ||
| str = str + "," + d.sys_id; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first value in the array will be empty. Perhaps you can use Array push? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push |
||
| } | ||
| return 'sys_idIN' + str; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you then can include the array to string |
||
|
|
||
| }, | ||
|
|
||
| type: 'getSameDeptUsers' | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an example of what the reference qualifier will look like? This would make it easier for other users to use.