history records with GlideRecord within e.g. 2 minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 06:26 AM
In business rule I want to find history incidents which where 2 minutes opened apart from current incident
something like
addQuery ('opened_at', <, current.opened_at.timeDiff(2) )
???
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 06:31 AM
Hi,
You can use this filter
In the query it will be like
addEncodedQuery('opened_atONCurrent minute@javascript:gs.beginningOfCurrentMinute()@javascript:gs.endOfCurrentMinute()^ORopened_atONLast minute@javascript:gs.beginningOfLastMinute()@javascript:gs.endOfLastMinute()' )
-Anurag

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 06:31 AM
Hi there,
You could create such a filter easily using the condition builder on any list. Then simply copy the breadcrumb, and use it in an encoded query:
2019-09-04 Utilizing the breadcrumb on lists to generate your query
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:09 AM
those javascript datetime functions is from now (or when they are executed). What I want to do is to check when the incident is resolved if there was other incident opened at approximately same time +-2minutes so I cannot use function gs.minutesAgo(2) or similar. I need to get incidents which are abs(current.opened_at-gliderecord.opened_at) < 2minutes .
So probably I need to do gliderecord.next() to go thru all records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 07:11 AM
When they a re executed