How to get user records that are updated after a particular time in the previous day
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2015 02:45 AM
Hi All,
We are trying to query the user records (from the sys_user table) that are updated after 03:30 EST yesterday by using glide record. This has to be done everyday to get the new users. Can anyone suggest any solutions to do that.
Thanks,
Pallavi
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2015 02:58 AM
query against the sys_created_on field for new users
If you query against the sys_updated_on field, you will get updatews
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2015 03:11 AM
Thanks for your reply julian
Yes, I am aware of querying on sys_updated_on to get updated records.
here am worrying about condition to specify "updated records after 3.30PM yesterday".
how to add this condition to query?
var user = new GlideRecord('sys_user');
user.addQuery('sys_updated_on',<<condition to get updated users after 3.30PM yesterday>>);
can you please guide me on filling place holder <<condition to get updated users after 3.30PM yesterday>>
Thanks,
Pallavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2015 03:21 AM
I would use the GlideDateTime API and establish the date for yesterday - getDate() and addDaysUTC(-1)
I would then use this in an encoded query replacing the date part with the correct date
active=true^sys_created_on>javascript:gs.dateGenerate('2015-08-25','23:59:59')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2015 04:32 AM
Try this. Define it in a script include and call it in the filter
var yesterdaysDate = gs.yesterday();
var yesterdayArrayVal = yesterdaysDate.toString().split(' ');
var formattedDate = new GlideDateTime(yesterdayArrayVal[0]+" "+'03:30:00');