Create a report for RITMs closed on last working day

chatsaurav19
Tera Contributor

Hi All,

 

I need to create a report which should reflect all the RITM details ( list view ) 'closed' on the last working day. 

 

Ex. If 'Friday' is the last working day then the report should show all those RITMs

 

It'll be great if someone could help me out

 

Thanks and Regards,

Saurabh Chatterjee

14 REPLIES 14

@chatsaurav19 

your script include should be client callable so that it can be called from report

Report filter condition

SysId [IS ONE OF] getTickets()

Refer below link and then once you get the date query on your table

How can I subtract time from a date? The Schedule class ignores negative durations.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

Thank you for your reply!

 

Can you please help me understand how to call the script include for the 'closed' field? I do not see any option to call the script include for this field

 

chatsaurav19_0-1736171924306.png

Regards,

Saurabh

@chatsaurav19 

As already mentioned you should use filter condition as

SysId [IS ONE OF] javascript:getRecords()

The script include should be client callable

In that script include you should determine the closed date and then query

Something like this

function getRecords() {

    // determine last working day before today as per Schedule logic
    var arr = [];
    var gr = new GlideRecord("tableName");
    gr.addQuery("closed_at", yourValue);
    gr.query();
    while (gr.next()) {
        arr.push(gr.getUniqueValue());
    }
    return arr.toString();
}

AnkurBawiskar_0-1736172792550.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@chatsaurav19 

I believe I have provided enough help and guidance for your question.

Based on your developer skills you can enhance it further for your requirement.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

Indeed this has helped - just one last query. As you can see I have applied the logic but when I am testing the script include I am not able to see any 'logs' getting recorded i.e. once I am running the report, the script include is not getting called

 

chatsaurav19_0-1736246353346.png

 

chatsaurav19_1-1736246391991.png

 

chatsaurav19_2-1736246583251.png

Am I getting incorrect somewhere?

Regards,

Saurabh