Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

list of incident related scripting

Anjali yadav1
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