- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 01:05 AM
Hi Everyone,
I'm trying to pull out incidents via background script that is updated 2 days ago. But it returns 0 record. But when I checked manually on the list. There are records that are last updated 2 days ago. Thank you so much for your help.
Regards,
Diane
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 04:55 AM
I was able to create an EncodedQuery for this and it gives me the results I need. Regardless, thank you all for your response.
gr.addEncodedQuery('sys_updated_onBETWEENjavascript:gs.daysAgoStart(2)@javascript:gs.daysAgoEnd(2)');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 02:37 AM
Hi Diane,
So what query you are applying in the filter to get the records from the table list? copy same and use that?
Is it not working for the same?
Also can you share the background script here?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 01:25 AM
Hi
You wrote, you are using encoded queries in scripts. I think, they are harder to read, then using "addQuery" Statements in the GlideRecord.
Try to convert your encoded query to single:
gr.addQuery(..);
statements. That will make your code more maintainable for the future. If you can solve your issue with that, it may be a good proof, that it may be better NOT using encoded queries in scripts.
Let me know if that solved your issue, and mark my answer as correct and helpful.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 01:37 AM
Hi Diane
If you change your query to show Incidents updated 'at or before' 2 days ago do you get results? If yes, then it looks similar to this thread which suggests is a known issue - albeit I can't access the PRB record mentioned:
Hope it helps.
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 02:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2019 02:40 AM
This may help you.
Thank you,
Ali