How to use script include function in report
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
script include :
var BlankRequestChecker = Class.create();
BlankRequestChecker.prototype = {
initialize: function() {},
getBlankRequestList: function() {
var blankRequestSysIDs = [];
var req = new GlideRecord('sc_request');
req.addQuery('active', true);
req.query();
while (req.next()) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', req.sys_id);
ritm.query();
if (ritm.hasNext()) continue;
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval', req.sys_id);
approval.addQuery('state', 'requested');
approval.query();
if (approval.hasNext()) continue;
var task = new GlideRecord('sc_task');
task.addQuery('request', req.sys_id);
task.addQuery('active', true);
task.query();
if (task.hasNext()) continue;
blankRequestSysIDs.push(req.sys_id.toString());
}
return blankRequestSysIDs;
},
type: 'BlankRequestChecker'
};
This is how I call it in report, it is showing error

This is how I call it in report, it is showing error
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago
your script include should be client callable then only it can be called from report filter condition
If you have created the Script Include in ServiceNow version "Washington" and above make sure, you have checked the "Sandbox enabled" Checkbox.
var BlankRequestChecker = Class.create();
BlankRequestChecker.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getBlankRequestList: function() {
var blankRequestSysIDs = [];
var req = new GlideRecord('sc_request');
req.addQuery('active', true);
req.query();
while (req.next()) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', req.sys_id);
ritm.query();
if (ritm.hasNext()) continue;
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval', req.sys_id);
approval.addQuery('state', 'requested');
approval.query();
if (approval.hasNext()) continue;
var task = new GlideRecord('sc_task');
task.addQuery('request', req.sys_id);
task.addQuery('active', true);
task.query();
if (task.hasNext()) continue;
blankRequestSysIDs.push(req.sys_id.toString());
}
return blankRequestSysIDs;
},
type: 'BlankRequestChecker'
});
💡 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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
37m ago
its already client callable still getting the error
