Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need help with filtering users by last_found field in sys_user table

Ashok_Bandla
Tera Expert

I have a custom field called last_found in the sys_user table. The field type is Date and Time. I want to filter users who were last found 12 hours ago.

I initially used a filter for 2 hours, which worked fine. But when I updated the filter to 12 hours, it stopped working.

Could someone please guide me on how to properly filter users based on the last_found field for the last 12 hours?

Thanks in advance!

Code for 2 hours : 

 

u_accc_last_foundONLast 2 hours@javascript:gs.beginningOfLast2Hours()@javascript:gs.endOfLast2Hours()

code for 12 hours: u_accc_last_foundONLast 12 Hours@javascript:gs.beginningOfLast12Hours()@javascript:gs.endOfLast12Hours()

2 REPLIES 2

Rafael Batistot
Kilo Patron

hi @Ashok_Bandla, Try to 

u_accc_last_foundBETWEEN@javascript:gs.hoursAgoStart(12)@javascript:gs.now()

This will fetch all users whose last found is between now and 12 hours ago.

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.

Muhammad Salar
Giga Sage

Hello @Ashok_Bandla ,
Try this 

MuhammadSalar_0-1749743191029.png