- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 12:27 AM
Hi All,
I would like to get the Manager id of in-active user id. So, to get the "In-active" user using Glide Record, I am using following script
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', gs.getUserID());
gr.query();
it return a user data along with his Manager id. But this manager record is as In-Active. So, I would like to get the Manager of this in-active manager. I use below script
but, it does not return any data
var gr1 = new GlideRecord('sys_user');
gr1.addQuery('sys_id', gr.manager);
gr1.query();
if (gr1.next())
{
gs.addInfoMessage('InActive Mgr:' + gr.name + ':' + gr1.manager);
}
it does not return any Inactive users data.
Is it possible to get any In-active user data using GlideRecord?
Could you please let me know any valuable guidance or suggestions ?
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 12:13 AM
Hi
There is a default business rule on the sys_user table called "user query"
It will prevent non admin users from accessing inactive user records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 09:38 PM
Hi Varadharaj,
still your requirement is not fulfilled let me know.. otherwise please mark correct so that others can find the solution easily..
Regards,
Sadasiva
Please mark helpful/ correct based on the impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 04:27 AM
Hi
Do you by any chance have an onQuery business rule on the sys_user table preventing you from quering for inactive users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2017 08:53 PM
Hi Lars Tange,
I am trying to get the manager data in Service Portal page. I do not have this OnQuery business rule. However, you have given valuable tips to handle this type of issue.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 12:13 AM
Hi
There is a default business rule on the sys_user table called "user query"
It will prevent non admin users from accessing inactive user records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 12:22 AM
We have the same issue where sometimes non admin users actually need to be able to query for inactive user records.
I have solved it this way:
- The Condition of the business rule has been changed to:
gs.getSession().isInteractive() && !gs.hasRole("admin") && !gs.hasRole("view_inactive_users") && gs.getSession( ).getClientData('searchInactive') != 'true' - I have a script include to do the search via Ajax. In this when the non admin user needs to query an inactive record, i set the session variable "searchInactive" to true like this:
gs.getSession( ).putClientData('searchInactive', 'true'); //Put session value to disable BR 'user query' temporarily - At this moment the user is able to query all records in the user table - also if they access it directly
- So when the search has been done we need to change it back again:
gs.getSession( ).putClientData('searchInactive', 'false'); //Enable BR 'user query' again