Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

list of incident related scripting

AnjaliY27945328
Tera Contributor

hello everyone, can anyone write the script for getting the list of incidents updated today

1 REPLY 1

JP - Kyndryl
Kilo Sage
var GetUpdatedTodayIncidents = Class.create();
GetUpdatedTodayIncidents.prototype = {
    initialize: function() {
    },
 
    getIncidentsUpdatedToday: function() {
        var incidents = [];
        var gr = new GlideRecord('incident');
        var today = new GlideDateTime();
        today.setDisplayValue(gs.nowDateTime());
 
        gr.addEncodedQuery('sys_updated_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
        gr.query();
 
        while (gr.next()) {
            var incident = {
                number: gr.getValue('number'),
                short_description: gr.getValue('short_description'),
                sys_updated_on: gr.getValue('sys_updated_on')
            };
            incidents.push(incident);
        }
 
        return incidents;
    },
 
    type: 'GetUpdatedTodayIncidents'
};
 
Regards,
JP