- 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-04-2019 10:36 AM
Hi there,
You are mentioning that you prefer to do this thru scripting, and also not an area of expertise.
Why scripting? And if it's not your expertise, why considering this? Who is going to maintain this?
Also: you could easily do this with no scripting. In a workflow for example, just with the available utilities, have a time run 4 days after the start date variable, and then create the task.
What should functionally happen? For example, the task is created far after the creation of the RITM. What if the RITM is already handled then, maybe even closed?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2019 12:30 PM
I would have done this but I am not seeing the start date variable from the "tree"...
Also I can read scripts just not great at writing them. I will be the one to maintain.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 04:33 AM
But what about my question:
What should functionally happen? For example, the task is created far after the creation of the RITM. What if the RITM is already handled then, maybe even closed?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 04:41 AM
Long story short, there is an action that needs to happen 4 days from the new hires start date.
All of our agents know not to manually close or mark RITMS and/or REQs as complete. The workflow will handle that.
The new hire ticket is created with a start date of mm/dd/yyyy.
There are other tasks that are created I just need one to be created 4 days after the start date because of the action that needs to happen to complete the onboarding process.