Report to check if the Service end date is equal to 90 days from the current date

Bhavana Reddy
Mega Guru

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

find_real_file.png

 

 

find_real_file.png

Please guide me guys.

3 REPLIES 3

sonali panda1
Kilo Sage

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.

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

Hitoshi Ozawa
Giga Sage
Giga Sage
Hi Bhavana,

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();