Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Setting due dates on Catalog Tasks

terrieb
Tera Guru

below is the script I found on this site for setting the due date on catalog tasks to match the due date on Request/RITM, which works just fine.

current.due_date = task.due_date;
var request = current.request.getRefRecord();
request.due_date = task.due_date;
request.update();

I have been asked if there is anyway we can add a formula in this advanced script area on the workflow that the due date would be 3 days AFTER the Request/RITM due date.

 

For example, the due date on the Request/RITM is 4/20, based on the creation date of today, but they want the due date on the task to be 4/23 instead?

 

Thanks

3 REPLIES 3

Uncle Rob
Kilo Patron

Why would a subtask of a RITM be due 3 days after the RITM itself?

Because there are a set amount of catalog tasks that have to be completed before the RITM's due date.  The item I am addressing is a Loaner Laptop request.  ITS Teams have to do several tasks before the issue out the loaner laptop (closing the RITM).  Make sense?

We want the task due date to be 7 days before the due date.  No variables in this catalog item or else I would have used this script.  

var gdt = new GlideDateTime(current.variable_pool.end_date);


gdt.addDays(-7);


task.due_date = gdt;