Date Calculation on Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 03:08 AM
HI Team,
I have requirement, where I need to set a filter to check for a specific day from laskweek.
Example: I need to fetch records where the "week_starts_on" that specific day.
I have written the logic in a script Include and want to call that in report filter using "javascript: " , but I am not sure if it is possible.
Could you please suggest me how this can be achieved. Below is the screenshot where I want to call the script Include
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 01:00 AM
Hello,
Did you get chance to look into solution provided by me. Please let me know if you need any help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 03:49 AM
Hi msm
You can return list of sys_id's that match your filter from your script include.
Check below links on how to call script includes from the report, try and let us know if you're stuck
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 03:54 AM
Hello Rohila,
It is a date field as per my script it will return a specific date.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 03:58 AM
Can you share the scriptinclude logic.
You should handle all the logic in scriptinclude and return list of sys_id's that match your filter.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 04:55 AM
Here is the code:
getLastweekstartdate: function() {
var gd = new GlideDate().getDate();
var lastWeek = gd.getDayOfWeek()+9;
gw = new GlideDateTime(gd);
gw.addDays(-(lastWeek));
return gw;
},