- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I need to create a filter that takes the logged-in user in the variable set (it will always be a manager) and only displays users who have the logged-in user as their manager in the employee name field. The employee name field is a reference type for the sys_user table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello @larissaribe,
Option 1:
If this variable is reused across many items, move the logic into a Script Include so you can maintain it in one place.
Script Include (server‑side, not client‑callable):
var DirectReportsUtil = Class.create();
DirectReportsUtil.prototype = {
initialize: function () {},
getDirectReportsQuery: function () {
// Add any additional constraints here
return 'manager=' + gs.getUserID() + '^active=true';
},
type: 'DirectReportsUtil'
};
On the variable, set Reference qualifier to Advanced and use:
// Use a JavaScript expression to invoke the Script Include
answer = new DirectReportsUtil().getDirectReportsQuery();
Option 2:
Use this when the variable is a reference to sys_user
.
- Open your variable (inside the variable set).
- Set:
- Type: Reference
- Reference:
sys_user
- Reference qualifier: Advanced
- In Advanced reference qualifier (script) paste:
// Returns only the direct reports of the logged-in user // (OPTIONAL) appends active=true to avoid inactive users in the list answer = 'manager=' + gs.getUserID() + '^active=true';
That’s it. The reference field will now only display users whose
manager
equals the current (logged‑in) user.
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks
Santosh.p
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
I believe you have already achieved the loggedin user part so for employee part add the below reference qualifier advanced condition of employee.
javascript:”manager=“+current.variables.requested_for;
// replace &colon with “:” and check the variable name having manager and replace it for requested_for
Please mark the answer correct/helpful accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello @larissaribe,
Option 1:
If this variable is reused across many items, move the logic into a Script Include so you can maintain it in one place.
Script Include (server‑side, not client‑callable):
var DirectReportsUtil = Class.create();
DirectReportsUtil.prototype = {
initialize: function () {},
getDirectReportsQuery: function () {
// Add any additional constraints here
return 'manager=' + gs.getUserID() + '^active=true';
},
type: 'DirectReportsUtil'
};
On the variable, set Reference qualifier to Advanced and use:
// Use a JavaScript expression to invoke the Script Include
answer = new DirectReportsUtil().getDirectReportsQuery();
Option 2:
Use this when the variable is a reference to sys_user
.
- Open your variable (inside the variable set).
- Set:
- Type: Reference
- Reference:
sys_user
- Reference qualifier: Advanced
- In Advanced reference qualifier (script) paste:
// Returns only the direct reports of the logged-in user // (OPTIONAL) appends active=true to avoid inactive users in the list answer = 'manager=' + gs.getUserID() + '^active=true';
That’s it. The reference field will now only display users whose
manager
equals the current (logged‑in) user.
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks
Santosh.p
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
I believe you have already achieved the loggedin user part so for employee part add the below reference qualifier advanced condition of employee.
javascript:”manager=“+current.variables.requested_for;
// replace &colon with “:” and check the variable name having manager and replace it for requested_for
Please mark the answer correct/helpful accordingly.