I want to check which user record got inactive in 90 last days using script.

SUser1234
Tera Contributor

I want to check which user record got inactive in 90 last days using script using the history table not from user table filter.

10 REPLIES 10

You should be able to do it on any table that has an active flag.

Hello @SUser1234 

You need to visit sys_user table. 

Double click on All, a popup will appear. Add the filter condition and click Ok.

JuhiPoddar_0-1736181791958.png

You can see the list of records that matches the condition.

 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

Is auditing for the user table enabled in your instance? Normally it is not. Of course, if auditing is not enabled for the user table, you won't be able to query the history/audit table.

Hi Jennifer I want to check by using history table and not query from user table 

Juhi Poddar
Kilo Patron

Hello @SUser1234 

Here is the script to meet your requirement:

var grUser = new GlideRecord('sys_user');
grUser.addEncodedQuery('active=false^sys_updated_onRELATIVEGT@dayofweek@ago@90');
grUser.query();
var user = [];
while(grUser.next()){
	user.push(grUser.getDisplayValue('name'));
}
gs.print(user);

Result:

JuhiPoddar_0-1736182549572.png

Note: The following script displays the user who are inactive and record last updated before 90 days.

 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar