Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to add 5 business days using flow designer?

sailor_moon
Tera Contributor

How to add 5 business days using flow designer? It should auto populate the next contact date once I run test. Please help me. Thank you!

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello ,can you try this below script

var contactDate = new GlideDateTime(fd_data.trigger.current.your_last_contact_field_backend_name);
var days = 5;
//assuming there are 8 business hours
days = days*8;
var dur = new GlideDuration(60 * 60 * 1000 * days);
var schedule = new GlideSchedule('your_schedule_sys_id'); //put your schedule sys_id here which can be 9 to 6 or 8 to 5 schedule which can be found in cmn_schedule table
return schedule.add(contactDate, dur);

MARK MY ANSWER CORRECT IF IT HELPS YOU

View solution in original post

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

Hello ,can you try this below script

var contactDate = new GlideDateTime(fd_data.trigger.current.your_last_contact_field_backend_name);
var days = 5;
//assuming there are 8 business hours
days = days*8;
var dur = new GlideDuration(60 * 60 * 1000 * days);
var schedule = new GlideSchedule('your_schedule_sys_id'); //put your schedule sys_id here which can be 9 to 6 or 8 to 5 schedule which can be found in cmn_schedule table
return schedule.add(contactDate, dur);

MARK MY ANSWER CORRECT IF IT HELPS YOU

Hi @Mohith Devatte  ,may I know what is the 60 here? I tried using the script provided but my next contact date becomes next month. 

60 * 60 * 1000 * days

 

Community Alums
Not applicable

60 m, 60 sec, 1000 millisec