Record updated by

Nenad Berbatovi
Tera Contributor

Hello,

 

I would like to make a report on INC not updated by itil role last 5 days. Is it possible and how?

 

Best regards,

 

Nenad

1 REPLY 1

Ankur Bawiskar
Tera Patron

@Nenad Berbatovi 

not straight forward to achieve this

You can use scripted approach and use script in report filter conditions

1) create classless script include like this

function getIncidents() {
    var arr = [];
    var gr = new GlideRecord('incident');
    gr.addActiveQuery();
    gr.addQuery('sys_updated_on', '<=', gs.daysAgoStart(5));
    gr.query();
    var count = 0;
    while (gr.next()) {
        var updater = gr.sys_updated_by;
        if (updater) {
            var ugr = new GlideRecord('sys_user_has_role');
            ugr.addQuery('user.user_name', updater);
            ugr.addQuery('role.name', 'itil');
            ugr.query();
            if (!ugr.hasNext()) {
                arr.push(gr.getUniqueValue())
            }
        }
    }
    return arr.toString();

}

AnkurBawiskar_0-1770963897994.png

2) then call like this Sys ID [IS ONE OF] javascript&colon; getIncidents();

AnkurBawiskar_1-1770963995072.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader