- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 11:29 AM
I am having trouble finding a way to limit a User Reference field to only show managers when selecting a user.
Below are fields on the "sys_user" table that would relate them to a Manager:
****All of the colored out values are user referenced names****
Let me know if this is possible in a simple JavaScript condition statement or if it needs to be done externally from the fields dictionary in a Script Include.
Thank You,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 11:41 AM
Here is the solution I have created. It works quite well.
BackfillUser:function(){
var idList = ' ';
var a = current.user;
if(!a){
return;
}
var user = new GlideRecord('sys_user');
user.addQuery('managerISNOTEMPTY');
user.addActiveQuery();
user.query();
while(user.next()){
if(idList.length > 0){
idList += (',' + user.manager.sys_id);
}
else{
idList = user.manager.sys_id;
}
}
return 'sys_idIN' + idList;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:09 PM
I had already commented out the items that arent required for my implementation but it was a bad call.. I wasn't adding the backfill portion to it... issue now is that its just sitting and grinding when I pull up the reference search.... we have 171k users in the table.... I'm thinking its just taking forever to create the filtered list? How many users are in the system you have this implemented in? Is this not a good idea for large user tables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 05:54 PM
I was only dealing with a few hundred employees. Not too familiar with large data in the example that you are using. I'm imagining that using such large sets of user data would take a bit longer to query and build the list. How long exactly is it taking? Are you on a strong network? Due to ServiceNow being a web application, network issues can come into play such as lack of wifi connection or low bandwidths.
Here is a link that can help:
http://wiki.servicenow.com/index.php?title=Troubleshooting_Performance#gsc.tab=0
(has helpful related links that provide information on the system diagnostics end of the servicenow platform)
To check your runtime and debug, go to the user preferences cog in the top right corner inside the header.
The JavaScript Debugger Window is located at the very bottom. You can see runtimes and issues when running the reference qualifier.
Let me know if you have any other questions or if any of this helped. I will look into it as well.