I would like to send a reminder email after 2 business days.

Prajwal Chauhan
Tera Expert

Let's say the initial email was sent out on 21 Feb 2025(exclude 21 feb), then the reminder email should be sent out on 25, excluding weekends and holidays. Using an 8:30 to 5 schedule.

 

Thanks

5 REPLIES 5

Mimi Edet
Tera Guru

 

Hi @Prajwal Chauhan,

Have you tried using Flow Designer with a Scheduled Trigger set for 27th Feb 2025 at 8:30 AM? Then, add a Send Email action, configure the recipients, subject, and body, and activate the flow. 🚀

 

Regards,

Mimi Edet

LinkedIn: https://www.linkedin.com/in/edet-promise/

=========================================================
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."

Ankur Bawiskar
Tera Patron
Tera Patron

@Prajwal Chauhan 

how are you sending the 1st email?

You can determine 2 business days after that using the below link and send the email again using eventQueue

Add Business Days 

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

I am using BR to send out the 1st email.
And for the reminder email, I am using a scheduled job to check daily when the initial mail was sent out.
I am looking for code where I can exclude the first day(doesn't matter if its weekday or holiday) and start count from next day.

@Prajwal Chauhan 

Now do this

1) as soon as you trigger event from BR add 2 business days to it

2) then just use this to send it at that time

Something like this

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    gs.eventQueue('event_name', current, recipients);

    // determine the next date time by adding business days
    var startDate = new GlideDateTime();
    var days = 2;
    //assuming there are 8 business hours
    days = days * 8;
    var dur = new GlideDuration(60 * 60 * 1000 * days);
    var schedule = new GlideSchedule('472acc8d1b521c1012c0dc6cdc4bcbb2'); //put your schedule sys_id here
    var end = schedule.add(startDate, dur);

    // this event will be processed at that end time
    gs.eventQueueScheduled('event_name', current, recipients, '', end);

})(current, previous);

I hope with this you can enhance code further

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