Create a catalog task based on requested item variables

Alex Saager1
Tera Contributor

I have a requirement to create a catalog task based on a requested item variable:

 

AlexSaager1_0-1681728849774.png

 

The catalog item is for users to use when staff are leaving, but the issue I have is that all the tasks are generated at the time of the request being submitted (normal behavior) but in some cases this can be for example a month in the future and then we have tasks sitting in queues for say a month with no action needed.

 

Is it possible to generate these tasks based on the date used on the catalog form?

 

So if for example someone is laving on the 01/05/23 then these tasks are created at that time.

 

Hope this is clear any ideas or suggestions would be greatly appreciated

 

Thanks

 

Alex

 

 

 

14 REPLIES 14

Community Alums
Not applicable

Ankur Bawiskar
Tera Patron
Tera Patron

@Alex Saager1 

you can use workflow timer activity and wait till particular date and then trigger the catalog task once the date is reached.

add this script in the timer advanced activity

var terminationDate = current.variables.termination_date.getDisplayValue();
answer = gs.dateDiff(new GlideDateTime(), terminationDate, true);

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

@Alex Saager1 

Thank you for marking my response as helpful.

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

@Ankur Bawiskar 

I'll be implementing this into our dev environment next week so after testing I will update accordingly.

Many thanks,

Alex