- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 10:30 AM
I have a Service Catalog item with a "start date" variable.
I need the workflow associated to the catalog item to create a task 4 days after that "start date".
I would prefer to do this via scripting (which is not an area of expertise).
Any out there able to help with a script?
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 06:34 AM
try below
var gdt = new GlideDateTime(current.variables.start_date);
gdt.addDays(4);
answer = gs.dateDiff(gs.nowDateTime(), gdt + ' 07:00:00', true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 04:12 AM
That resolved the issue with the error however the timer is not pausing.
I created a test request using 09-09-2019 for the start date. The task that I want to create 4 days after the start date got created. It shoud not have been created until 09-13-2019.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 10:51 PM
Hi Rachel,
Can you test it with small duration such as 4 hours etc
If that is ok then the days part will also work
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2019 01:09 PM
You can use below :
var gdt = new GlideDateTime(current.variables.start_date);
gdt.addDaysUTC(4);
var current_time_stamp = new GlideDatetime();
var today_date_time = new GlideDateTime(current_time_stamp.getDisplayValue());
if (today_date_time > gdt)
{answer = true;}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 04:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2019 04:56 AM