BR or background script to set record duration
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 02:30 PM
I have created a custom table with task records on it that I want to create certain statistics for that we have in incident. One big one is the duration of the record from start to finish. I am currently trying to run a job to do this for existing records, but I also want to set this up going forward. I have tried emulating the mark for closure BR that runs on incident but I couldn't get it to work, can someone please help me identify where I have gone wrong with this background script to start?
var gr = new GlideRecord("x_unoci_graduate_d_graduate_division"); <--(my custom table)
gr.addEncodedQuery('active=false^calendar_durationISEMPTY');
gr.query();
var dur = new DurationCalculator();
dur.setSchedule('090eecae0a0a0b260077e1dfa71da828'); <---(the schedule our instance uses)
gr.calendar_duration = dur.calcScheduleDuration(startdatetime, enddatetime);
while(gr.next()) {
gr.calendar_duration = dur;
gr.setWorkflow(false);
gr.update();
}
Labels:
- Labels:
-
Scripting and Coding
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 07:56 AM
Check out the following community post for possible alternative: