UserManagement#1913
Conversation
|
|
||
| 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. |
There was a problem hiding this comment.
Can you add an example of what the reference qualifier will look like? This would make it easier for other users to use.
| getSameDeptUsers.prototype = { | ||
| initialize: function() {}, | ||
| getSameDept: function() { | ||
| var user = gs.getUser().getDepartmentID(); |
There was a problem hiding this comment.
var user is not a good name for the Department. Perhaps userDepartment?
|
|
||
| var str = ""; | ||
| while (d.next()) { | ||
| str = str + "," + d.sys_id; |
There was a problem hiding this comment.
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
| while (d.next()) { | ||
| str = str + "," + d.sys_id; | ||
| } | ||
| return 'sys_idIN' + str; |
There was a problem hiding this comment.
Here you then can include the array to string
|
Thank you for your submission, please see the review notes for the needed adjustments. Please note that your reference qualifier might result in unexpected behavior as for users also the Assignment group will determine which users show (as past of the group). |
PR Description:
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions