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

Ankur Bawiskar
Tera Patron
Tera Patron

@Dillin Bradley 

you are using workflow or flow designer for this?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Dillin Bradley 

if you are using flow designer then you can use inline script

something like this

AnkurBawiskar_0-1704984949095.png

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ! I am using Workflow!

@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