- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2017 03:18 AM
tickets which are not updated in LAst 5 days - this reports i used to fetch via Updated RElative 5 days filter. but later due to some business requirements i implemented a Schedule job which runs daily ad updates every ticket's DURATION field [current date - Created Date], but due to this every ticket is technically updated on daily basis
we want to see the ticket which were not updated [means Commented in Customer or Work Notes section]. can you help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2017 05:49 AM
use this
var nonInc = new GlideRecord('task');
nonInc.addEncodedQuery('active=true^sys_class_name!=incident');
nonInc.autoSysFields(false);
nonInc.query();
//gs.log("Found " + nonInc.getRowCount() + " records");
while(nonInc.next()){
var now = gs.nowDateTime();
var opened = nonInc.opened_at.getDisplayValue();
var calDur = gs.dateDiff(opened, now, false);
nonInc.calendar_duration = calDur;
nonInc.update();
}
var inc = new GlideRecord('incident');
inc.addEncodedQuery('active=true^state!=6');
inc.autoSysFields(false);
inc.query();
//gs.log("Found " + inc.getRowCount() + " incident records");
while(inc.next()){
var now = gs.nowDateTime();
var opened = inc.opened_at.getDisplayValue();
var calDur = gs.dateDiff(opened, now, false);
inc.calendar_duration = calDur;
inc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2017 03:24 AM
Hi Ankit,
Use this in your scheduled job
autoSysFields(false);
This will not update the system fields inlcuding update on and hence your filter will work. Read more here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2017 04:32 AM
Thanks Anurag for your kind support, i have added to my scheduled job, will confirm you back tomorrow . Thanks once again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2017 04:17 AM
Hey Ankit,
Did this work??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2017 05:19 AM
hi t_anurag, i have this scheduled job , but i am seeing after adding the suggested one that yesterday even this updated the tickets , is there something i am making mistake?
var nonInc = new GlideRecord('task');
nonInc.addEncodedQuery('active=true^sys_class_name!=incident');
nonInc.query();
//gs.log("Found " + nonInc.getRowCount() + " records");
while(nonInc.next()){
var now = gs.nowDateTime();
var opened = nonInc.opened_at.getDisplayValue();
var calDur = gs.dateDiff(opened, now, false);
nonInc.calendar_duration = calDur;
nonInc.autoSysFields(false);
nonInc.update();
}
var inc = new GlideRecord('incident');
inc.addEncodedQuery('active=true^state!=6');
inc.query();
//gs.log("Found " + inc.getRowCount() + " incident records");
while(inc.next()){
var now = gs.nowDateTime();
var opened = inc.opened_at.getDisplayValue();
var calDur = gs.dateDiff(opened, now, false);
inc.calendar_duration = calDur;
inc.autoSysFields(false);
inc.update();
}