How to auto populate due date to +3 days from current date in case form

Bala13
Kilo Guru

Hi,

I have a requirement to auto populate due date field +3 business days with current date.

Can anyone help me to fix the issue?

I tried to add before insert BR but its not working as expected.

var sd = new GlideDateTime(gs.nowDateTime());
sd.addDays(3);

current.due_date=sd;

1 ACCEPTED SOLUTION

If you want to show date after 3 days when user open new form (to create new record ) then you can set default value at dictionary level by overriding dictionary of due_date field.

find_real_file.png

 

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

7 REPLIES 7

Anil Lande
Kilo Patron

Hi,

sd.addDays(3); will not work in scoped app instead you can use

sd.addDaysUTC(3); or sd.addDaysLocalTime(3);

 

Your updated script would be:

var sd = new GlideDateTime(gs.nowDateTime());
sd.addDaysUTC(3);
//sd.addDaysLocalTime(3);

current.due_date=sd;

 

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

If you want to show date after 3 days when user open new form (to create new record ) then you can set default value at dictionary level by overriding dictionary of due_date field.

find_real_file.png

 

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi,

gs.nowDateTime() is also not supported in scoped applications.

Your script should be like this:

var sd = new GlideDateTime();
sd.addDaysUTC(3);
//sd.addDaysLocalTime(3);
current.due_date=sd.getDisplayValue();

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande