Automated Indicator to call a script include

Krithika R
Tera Contributor

Hi All,
I am calling a script include from an automated indicator, but it is not working. When i calling the same script from report it is giving me the count.
Sys ID is javascript : new get_case_sys_id().get_caseid();

KrithikaR_0-1666851037993.png

Script Include:

var get_case_sys_id = Class.create();
get_case_sys_id.prototype = Object.extendsObject(AbstractAjaxProcessor, {


    get_caseid: function() {

        var user_id = [];
        var case_table = new GlideRecord('sn_customerservice_case');
        case_table.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
        case_table.query();
        while (case_table.next()) {
            user_id.push(case_table.getValue('sys_created_by') + '');
        }

        //...................unique array..................//

        var arrayUtil = new global.ArrayUtil();
        //  var arrayUtil = new ArrayUtil();
        arr = arrayUtil.unique(user_id);
        for (var i = 0; i < arr.length; i++) {

            var sysid = [];
            var sntab = new GlideAggregate('sn_customerservice_case');
            sntab.addEncodedQuery('sys_created_onONToday@javascript&colon;gs.beginningOfToday()@javascript&colon;gs.endOfToday()^sys_created_by=' + arr[i]);
            sntab.query();
            var rocount = sntab.getRowCount().toString();
            while (sntab.next()) {
                ///get sysid of the case record only, if the user has submitted request more than 5 times.......
                if (rocount >= 3) {
                    sysid.push(sntab.getValue('sys_id') + ' ');
                }
            }
            //gs.print('sys_id....' + sysid);
            // return sysid;
        }
        return sysid;
    },


    type: 'get_case_sys_id'
});

It is Client Callable too.. 
I don't know what is wrong in this can anyone help me please

3 REPLIES 3

Sai Kumar B
Mega Sage
Mega Sage

@Krithika R 

If the script include response contains multiple sys_id(s) update your filter condition as sys_id is one of

Hi,
I tried that too still it not giving the count for it.

@Krithika R 

Try running the Script Include in Background script and check whether you're getting the proper response or not