- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 10:56 AM
This is on Kingston
glide-kingston-10-17-2017__patch12-11-28-2018_12-04-2018_0932
When I run the following script as a background script I get the same value for the two function calls
gs.info("2 years: " + gs.beginningOfLast2Years() + " One year: " + gs.beginningOfLastYear());
*** Script: 2 years: 2018-01-01 08:00:00 One year: 2018-01-01 08:00:00
How can gs.beginningOfLast2Years() and gs.beginningOfLastYear() return the same value?
Vinod Kumar Kachineni
Community Rising Star 2022
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:16 AM
Hi,
I don't see gs.beginningOfLast2Years() anywhere in ServiceNow docs. So I have only suggestion for you to figure out the beginning of the year/years based on gs.beginningOfLastYear() + use GlideDateTime method .addYearsLocalTime(-1).
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:16 AM
Hi,
I don't see gs.beginningOfLast2Years() anywhere in ServiceNow docs. So I have only suggestion for you to figure out the beginning of the year/years based on gs.beginningOfLastYear() + use GlideDateTime method .addYearsLocalTime(-1).
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:35 AM
Thanks Alexey,
I was using the filter on a list to get a list of lincidents created before last 2 years
When I copied the query, it showed the following filter
sys_created_on<javascript:gs.beginningOfLast2Years()
This led me to believe there is a gs.beginningOfLast2Years().
Thanks,
Vin
Vinod Kumar Kachineni
Community Rising Star 2022