- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2024 06:25 AM
I have a requirement to select inactive whose last login was 25 days ago and 35 days ago. I have used the script below to meet try this requirement but it returns for someone whose last login is 20 days ago and when I changed the days to either 25 or 35 days it returns no value:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2024 07:43 AM
Have you manually checked to see if there are records that satisfy that condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2024 01:27 PM
Hello @Adeshola
Here is the updated script:
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('last_login!=NULL^active=true^last_loginRELATIVELT@dayofweek@ago@251^locked_out=false^user_nameNOT LIKEadmin');//for 30 days just replace 25 to 30
gr.query();
while(gr.next()) {
gs.print('Inactive User: ' + gr.name);
}
This works smoothly in my PDI. Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2024 01:27 PM
Hello @Adeshola
Here is the updated script:
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('last_login!=NULL^active=true^last_loginRELATIVELT@dayofweek@ago@251^locked_out=false^user_nameNOT LIKEadmin');//for 30 days just replace 25 to 30
gr.query();
while(gr.next()) {
gs.print('Inactive User: ' + gr.name);
}
This works smoothly in my PDI. Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar