I want to generate a report on task table which will exclude weekends and which has been updated only before 2 days

Swarnarghya Gho
Giga Contributor

I want to generate a I want to generate a report on task table for one group (task type = catalog task)  which will exclude the updates made on weekends and which has been updated only before 2 days. Suppose today I am running the report, it will show the records which has been updated before 2 business days i.e. before 28th June.It should not show records updated on 28th June, weekends and 1st July.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Swarna,

so you can try this; see screenshot below and let me know

find_real_file.png

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Swarna,

so you can try this; see screenshot below and let me know

find_real_file.png

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Well, thanks for your response.

I created the report same way likewise but it is showing up the records which has been updated on Friday i.e 28th June

Hi Swarna,

I think for this you need to have script include and use function; call that from the report

in the server side script do this

1) query the task table with type as catalog task

2) get the updated time sys_updated_on

3) from that time determine the day of week if it is 6 or 7 it means it is weekend; week starts on monday so it is 1 for monday

sample: 

var gdt = new GlideDateTime("2011-12-01 12:00:00");
gs.print(gdt.getDayOfWeek());

4) check the difference between now date time and updated time

5) get the difference based on schedule calculation if it is more than 2

https://community.servicenow.com/community?id=community_question&sys_id=d8e19baddbdcdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=48b84361db5cdbc01dcaf3231f96...

6) push the sys_id into array

way to call the script include from report

sys_id is one of javascript: new ReportUtils().getReportRecords();

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Adam Stout
ServiceNow Employee
ServiceNow Employee

I would use an SLA based on update time that resets on each update and completes on close.  That will allow you to handle any business hours requirements (like holidays) and will allow you to adjust it for different items.  This should make reporting simple (on the SLA for the item).