Automated Indicator to call a script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:14 PM
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();
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:gs.beginningOfToday()@javascript: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:22 PM
If the script include response contains multiple sys_id(s) update your filter condition as sys_id is one of
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:29 PM
Hi,
I tried that too still it not giving the count for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 11:36 PM
Try running the Script Include in Background script and check whether you're getting the proper response or not