- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 02:19 PM
I want to run background scripts to update resolved date to current date and time
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery("sys_id","3751d2e11be113d9c4bcb7d");
gs.print(gr.getRowCount());
gr.query();
while(gr.next())
{
gr.state = 6 ;
//update resolved date
gr.resolved_at = (current date and time);
gr.update();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 02:30 PM
Hi Zuri,
Use gs.nowDateTime();
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery("sys_id","3751d2e11be113d9c4bcb7d");
gs.print(gr.getRowCount());
gr.query();
while(gr.next()){
gr.state = 6 ;
//update resolved date
gr.resolved_at = gs.nowDateTime();
gr.update();
}
Regrads,
Nayan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022 02:30 PM
Hi Zuri,
Use gs.nowDateTime();
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery("sys_id","3751d2e11be113d9c4bcb7d");
gs.print(gr.getRowCount());
gr.query();
while(gr.next()){
gr.state = 6 ;
//update resolved date
gr.resolved_at = gs.nowDateTime();
gr.update();
}
Regrads,
Nayan