Set Due Date to a few days before catalog Variable Date

Dillin  Bradley
Tera Expert

Hello,

 

I am looking to add some logic to a Catalog item and am needing to set a Catalog Tasks due date to 5 days prior to a variable date.

On the catalog item, users are populating a "Go Live Date",  go_live_date, and after submission I would like a catalog task to get a due date of 5 business days prior to the date the end user submitted.

I am having issues with getting this to work and would appreciate some help!

1 ACCEPTED SOLUTION

@Dillin Bradley 

then in the catalog task activity use Advanced script and use this

var dt = new GlideDateTime(current.variables.go_live_date); // give correct variable name here
dt.addDaysUTC(-5);

task.setValue('due_date',dt.getValue()); // give correct field name here

Something like this

AnkurBawiskar_0-1704986810300.png

 

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

View solution in original post

7 REPLIES 7

Hi Ankur!

 This worked thank you!

@Ankur Bawiskar actually one follow up. It looks like it is doing total days, how can I have this script exclude weekends?

@Dillin Bradley 

you can use scripting and exclude weekends

How to add 5 days to a date excluding weekends 

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