How can we put query to check if a particular field got updated after certain date/time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2022 03:49 AM
How can we put query to see if a particular field got updated after certain time?
I tried with:
var gr = newGlideRecord('table');
var currentdate = new GlideDateTime;
addEncodedQuery('u_applied_service.sys_updated_on>=' + currentdate);
u_applied_service is a text field. And this code is going to be used in a scheduled Job. This is not working and I see above code gets interpreted as - sys_idNOTValidNull in Logs.
Anybody having idea on this?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 09:14 PM
Hi,
Any reason to keep the field "u_applied_service" as string and not date/time?
something like this when that field is date/time
gr.addQuery('u_applied_service', ">=", currentdate);
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
‎01-09-2022 09:33 PM
Hi Ankur,
Its a text field,which is showing Service name. I need to run a JOB looking at if that value got updated after currentdate.
I tried - 'u_applied_service.sys_updated_on', '>' , currentdate . This didn't work.
gr.addQuery('u_applied_service', ">=", currentdate);
This will not work as u_applied_service doesnt show any date/time value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 09:40 PM
Since you said "u_applied_service" holds string i.e. Service name so you cannot compare it with date time.
Are you storing somewhere when the field u_applied_service got changed?
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
‎01-09-2022 09:52 PM
No, i dont see anything such. In a table, how can we check if field got changed in scheduled job?I think, if I look at if that record got updated and then field value changed part. It can help me in achieving what I want to execute.