Due date on sc_task form should be one day prior to start date

C_S3
Tera Contributor

Hello All,
We have an requirement ,where when user will enter the start date on form ( catalog item form ) then after submitting the form, the due date field on sc_task form should be one day prior to start date.
Any help would be appreciated.
Thank you!

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@C_S3 

you can use inline f(x) script while creating the task in flow designer and set the due_date field

Just besides the set field value for Date field you will find script option.

Sample script as below

var userGivenDate = fd_data.trigger.request_item.variables.start_date;

var gdt = new GlideDateTime();
gdt.setValue(userGivenDate + ' 00:00:00');
gdt.addDaysUTC(-1);

return gdt.getValue();

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