Conditional Days code keeps not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 10:44 AM
I am hoping someone can look at my code below and tell me what I have wrong. I have a Scheduled Report running daily at 3 am however I want the report to only send out an email (run) if it is on a specific date. It sends the report out every day. Thanks in advance.
(function executeRule(){
var triggerDates = [
'05-29-2024',
'07-02-2024',
'07-30-2024',
'08-27-2024',
'10-01-2024',
'11-05-2024',
'12-03-2024',
'01-07-2024'
];
// Get today's date in MM-DD-YYYY format
var today = new GlideDateTime();
var todayFormatted = today.getByFormat('MM-dd-yyyy');
// Check if today's date is in the list of trigger dates
if (triggerDates.indexOf(todayFormatted) !== -1)
{answer = true;}
else
{answer = false;}
})
0 REPLIES 0