How to show only active users on reports

Priyanka132
Giga Contributor

Hi All,

We have requirement to make "active=true" to be a mandatory filter on all reports being created on the sys_user table. Our user table is very large and has a large data of inactive users. Hence, any query on sys_user table from report should query only active users (additional filters can be included as per reports requirement).

 

find_real_file.png

1 ACCEPTED SOLUTION

Omkar Mone
Mega Sage

Hi 

Try writing a before query BR on it. 

 

Something like this  :-

 

var tm = '';
var as = new GlideRecord('sys_user');
as.addQuery('active','true');
as.query();
while(as.next())
{
tm += as.name +',';
gs.addInfoMessage('ACTIVE User List : " +tm);
}

View solution in original post

5 REPLIES 5

Alikutty A
Tera Sage

Hello,

Are the users able to see/read inactive users if you remove this filter?

By default, any user except an admin cannot read inactive users. There is an OOB query business rule "user query" which already appends this query in all search requests to the user table. Even though you wont see it in the report, the query is added before the search is triggered on the user table. So I dont think it would help out.

 

thank you for your response.

I verified, the ITIL users are able to view the inactive users from the report module. However, would like to prevent them from viewing the same

There is an OOB business rule on sys_user table named "user query". Please activate it on your instance.

If you dont have it, here is a copy of it. You can create a new one

Condition: gs.getSession().isInteractive() && !gs.hasRole("admin")

Script: current.addActiveQuery();

find_real_file.png