- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 01:09 AM
how is it possible to send a report every 3 months? Only with 90 days? I want to send a report every last day each 3 months...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 06:26 AM
If the report needs to be sent every 90 days, you can configure the scheduled report to:
Run: Periodically
Repeat Interval: 90 days
Starting: Your desired start date.
However, if it needs to be the last day every 3 months, you would have to script this by checking "Conditional" and writing the script in "Condition".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 06:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 06:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 07:10 AM - edited ‎07-18-2024 11:57 PM
This seems like it would be possible as there is a condition field on Scheduled Reports. You could set the report to run monthly on the 31st day of the month (which i assume would translate to being the last day of any month which contains less than 31 days). In the condition field you could then do something similar to:
var validMonths = [3,6,9,12]; // Months where the report will run
var gd = new GlideDate();
validMonths.indexOf(gd.getMonthNoTZ()) > -1;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 07:13 AM
Hi @markusst ,
In the scheduled report module, there is an option called Conditional, please select that check box and you can write a code to control when the report should run.
In your the below code will do the trick -
function checkFirstDayofThirdMonth(){
var triggerMonths = [1, 4, 7, 10]; //Jan, Apr, Jul, Oct
var currDt = new Date();
var currMonth = currDt.getMonth()+1;
var currDate = currDt.getDayOfMonth();
for (i in triggerMonths){
if (currMonth == triggerMonths[i] && currDate == 1)
return true;
}
return false;
}
checkFirstDayofThirdMonth();
Plz mark my solution as Accept, If you find it helpful.
Thanks & Regards,
Sumanth meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 05:22 PM
I would check out Now Learning - https://nowlearning.servicenow.com. There are a handful of scripting courses available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 07:10 AM - edited ‎07-18-2024 11:57 PM
This seems like it would be possible as there is a condition field on Scheduled Reports. You could set the report to run monthly on the 31st day of the month (which i assume would translate to being the last day of any month which contains less than 31 days). In the condition field you could then do something similar to:
var validMonths = [3,6,9,12]; // Months where the report will run
var gd = new GlideDate();
validMonths.indexOf(gd.getMonthNoTZ()) > -1;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 07:13 AM
Hi @markusst ,
In the scheduled report module, there is an option called Conditional, please select that check box and you can write a code to control when the report should run.
In your the below code will do the trick -
function checkFirstDayofThirdMonth(){
var triggerMonths = [1, 4, 7, 10]; //Jan, Apr, Jul, Oct
var currDt = new Date();
var currMonth = currDt.getMonth()+1;
var currDate = currDt.getDayOfMonth();
for (i in triggerMonths){
if (currMonth == triggerMonths[i] && currDate == 1)
return true;
}
return false;
}
checkFirstDayofThirdMonth();
Plz mark my solution as Accept, If you find it helpful.
Thanks & Regards,
Sumanth meda