call script include in a report condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 02:47 AM
Hi All,
I have a script include which returns the sys_id of RITMs created on this month. I am trying to call that script include in the condition for a report like - Sys ID is one of javascript: new myRITM().thisMonthRITMs()
But I am not able to fetch any record in my report.
P.S. - I know that this can be done using the filter Created on This month, but I want to do it with a script include
Here is my script include:
Name: myRITM
Client callable: FALSE
Script:
var myRITM = Class.create();
myRITM.prototype = {
initialize: function() {
},
thisMonthRITMs : function()
{
var arr = [];
var querystring = 'active=true^sys_created_onONThis month@javascript:gs.beginningOfThisMonth()@javascript:gs.endOfThisMonth()';
var ritm = new GlideRecord('sc_req_item');
ritm.addEncodedQuery(querystring);
ritm.query();
while (ritm.next())
{
arr.push(ritm.sys_id);
}
gs.log('@@ ' + arr);
return arr;
},
type: 'myRITM'
};
Any help will be appreciated.
Thanks in advance!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 02:57 AM
Can you update the return statement to
return sys_idIN + arr.toString();
and try again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 03:04 AM
Hi dvp,
I have tried that as well but no success!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 03:19 AM
can you update this statement as well
arr.push(ritm.sys_id);
to
arr.push(ritm.sys_id.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 03:32 AM
Tried that as well but still no success.