Help with Scripting to Filter sys_user Table by Created Column

SN241
Tera Contributor

Hello,

I am new to scripting in ServiceNow and need assistance with 

creating a dynamic filter for a report that extracts data from the sys_user table based on the Created column. I'd like to achieve the following filtering criteria:

  1. A specific date and time (e.g., 2024-01-01 00:00:00)
  2. Wednesday 2 weeks ago
    SN241_1-1721122032135.png
  3. If the current day is Monday or Tuesday, the filter should input the date from 5 days ago. If it is any other day, the filter should input the date from 4 days ago at 23:59:59.
    SN241_0-1721121991644.png

     

Thank you in advance for your assistance.

6 REPLIES 6

Slava Savitsky
Giga Sage

Can you please explain the complete use case? What are you trying to achieve? Where exactly are you trying to apply filtering? What type of script are you trying to use for that?

OlaN
Giga Sage
Giga Sage

Hi,

Could you please clarify (with some more examples) what you want with this date/how it should be calculated?

Do you want a date that is always on a wednesday 2 weeks before a selected date?

SN241
Tera Contributor

Yes @OlaN, for the second filter,  I want a date that is always on a Wednesday 2 weeks ago.

If you want to find all users created on Wednesday two weeks ago, try the following filter:

SlavaSavitsky_0-1722022991315.png