- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 01:58 PM
I have an offboarding workflow that needs to wait to fire Tasks until the 'term_date'. I think i should use the wait for condition but I am not sure of the script that I should use. Can someone assist, please?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 02:42 PM
You can use a Timer activity for this.
If you're getting the value from a form field, set the value for Timer based on "A date/time or duration field" and then select your field.
If you're getting it from a variable, set the value for Timer based on "Script", then in the script field use the code below.
answer = gs.dateDiff(gs.nowDateTime(), current.variables.term_date, true);
You can read about gs.dateDiff here. http://wiki.servicenow.com/index.php?title=GlideSystem_Date_and_Time_Functions#dateDiff.28String.2C_...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 02:16 PM
1 ## you can use script like following in wait for activity. You can change the date script as per your need
(current.variables.u_term_date == gs.now())
{
answer = true
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 02:42 PM
You can use a Timer activity for this.
If you're getting the value from a form field, set the value for Timer based on "A date/time or duration field" and then select your field.
If you're getting it from a variable, set the value for Timer based on "Script", then in the script field use the code below.
answer = gs.dateDiff(gs.nowDateTime(), current.variables.term_date, true);
You can read about gs.dateDiff here. http://wiki.servicenow.com/index.php?title=GlideSystem_Date_and_Time_Functions#dateDiff.28String.2C_...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2017 09:15 PM
hi there,
I am trying to something similar for offboarding a user. I have a variable of term date. I do not want the associated tasks to kick off until 24 hours before the term date. How can i incorporate that into the above workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2019 03:03 AM
I am wondering this too - did you ever get an answer to this please?