javascript:gs.hoursago(24) is Giving Me Unexpected Results

kemmy1
Tera Guru

I'm testing a query of expected_start<=javascript:gs.hoursago(500) on the sysapproval_approver list.  (500 is just a number of hours for test purposes only)

500 hours ago is like back in March.  So why is it bringing back records with an expected start date of 4/3/2018?

4/3/2018 is not less than a date back in March (ie 3/1/2018) correct? 

Lisa

 

1 ACCEPTED SOLUTION

The SN Nerd
Giga Sage
Giga Sage

Because gs.hoursago(500) is invalid syntax.

 

Correct syntax (note the upper case A):

 

gs.hoursAgo(500)

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

4 REPLIES 4

The SN Nerd
Giga Sage
Giga Sage

Because gs.hoursago(500) is invalid syntax.

 

Correct syntax (note the upper case A):

 

gs.hoursAgo(500)

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Yep it was as simple as syntax!  I just tried it with gs.hoursAgo and it worked!!  

 

Thanks!

 

Lisa

Community Alums
Not applicable

Hi Kemmy,

 

It is bringing correct records 🙂

It will bring all records, except the records from last 20 days.

The condition, itself states, it should bring all records where expected date(3rd April) is less than 20 days back(i.e. 500 hours).

 

Let me know in case of any issues. 🙂

Sanket Khabiya
Kilo Sage

As it is syntax error: 

try this,

javascript:gs.hoursAgo(24)