Report to check if the Service end date is equal to 90 days from the current date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2022 12:39 AM
Hello Guys,
We have a requirement to generate the report on the Business Service table to extract records which has the Service end date equal to 90 days from the current date, so that we can send this report for the Service Owner to take the action for the Expiry
For that I have written a script include and called that script include from the report, but the script include returns no records
Please guide me guys.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2022 03:54 AM
In the reports you can directly use the relative operator like service end date is relative 90 days ago. I don't see a script include is needed. You will need a scheduled job to extract the report and send to service owner of only you are planning to automate the report generation and sending else a simple report should be suffice if I don't misunderstanding your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2022 09:22 AM
Thank you for your response,
My requirement is whenever the service end date is exactly equal to the 90 days from current date( current date+90 days) The report should be sent to the Service Owner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2022 08:54 PM
How is Script Include being called?
Change the Script Include as below.
var RecordsGoingToExpire = Class.create();
RecordsGoingToExpire.prototype = {
initialize: function() {},
getRecordsGoingToExpire: function() {
var gd = new GlideDate();
gd.addDays(90);
var gr = new GlideRecord('u_rfss');
gr.addQuery('u_service_end_date', gd);
gr.query();
var arry = [];
while (gr.next()) {
arry.push(gr.getValue('sys_id') + '');
}
return arry.join(',');
},
type: 'RecordsGoingToExpire'
};
Call the Script Include as below:
var result = new RecordsGoingToExpire().getRecordsGoingToExpire();