- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 08:51 AM
Hello All,
I am looking for a server side script to run daily on a scheduled job execution to update a custom Date field (u_glide_date_1) to the current date. I have a function field that displays the datediff between an Expiry Date field and Current Date field (u_glide_date_1), but I need an accurate current date every day for my function field to be correct.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 01:42 PM
I found this script to run in a Scheduled Job and does what I need it to do:
var gr = new GlideRecord('table_name'); //call the table
gr.addQuery('active', 'true'); //only update active records
gr.query();
while(gr.next())
{
gr.update(); //make update changes - OF WHICH THERE ARE NONE
gr.setForceUpdate(true); //force the record to update even though no actual changes have been made
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 02:36 PM
Try this.
new GlideDateTime.getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 01:42 PM
I found this script to run in a Scheduled Job and does what I need it to do:
var gr = new GlideRecord('table_name'); //call the table
gr.addQuery('active', 'true'); //only update active records
gr.query();
while(gr.next())
{
gr.update(); //make update changes - OF WHICH THERE ARE NONE
gr.setForceUpdate(true); //force the record to update even though no actual changes have been made
}