- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 10:52 AM
I am trying to add Timer in the workflow and trigger 7 days before the return date. I tried "A date/time or Duration field" but the variable field is not available to select so I guess I need a script. Also, I went through a lot of posts but unable to find something similar and some didn't work. Any help with the script will be appreciated.
Requirements are:
We would like the workflow to trigger 7 days before the return date.
Variable Name "Start_Date"
Thank you 🙂
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 11:30 AM
If it is date field than set time like. Also make sure you select date which is more than 7 days from now.
var gdt = new GlideDateTime(current.variables.Start_Date);
gdt.addDaysLocalTime(-7);
answer = gs.dateDiff(gs.nowDateTime(), gdt + " 07:00:00", true);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 10:54 AM
On Timer activity and in script section, add below
var gdt = new GlideDateTime(current.variables.Start_Date);
gdt.addDays(-7);
answer = gs.dateDiff(gs.nowDateTime(), gdt, true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 11:07 AM
Hello Mike,
I just tried this script but it triggered the task right after we submitted the request.
Thank you 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 11:08 AM
Is this DateTime field or Date
current.variables.Start_Date
Also share screenshot of timer activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 11:20 AM