- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 03:01 PM
Hello all,
I posted another question similar to this, but I thought I'd make its own thread. I have a workflow with 5 approvals that are triggered simultaneously. I also have a date field on the form called (Testing completion date). My requirement is to have a timer on the workflow where the approvals need to be approved by the testing completion date, which will most likely be 2-3 days after form submission. After the timer a task should be triggered. I know people suggested manual approvals or a timer workflow activity, but I'm not too sure on how to achieve this.
any recommendations?
Thanks in advance!
Grace
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 05:40 AM
In the timer based on dropdown, you have the option to choose either script or "A date/time or duration field".
If you select "A date/time or duration field". option, then you can choose the field based on which you want to set the timer.
If you select script option, then you can query and get the value of the variable something like
return current.variables.your_variable_name
or write a script and query if its some other value from DB.
Mark the comment as a correct answer and helpful if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 10:08 AM
Thank you for the response! I followed your guidance and got it to work. I ended up using the timer activity and adding in an advanced script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 11:28 AM
Any chance you'd be willing to share that script? I have a similar need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 11:59 AM
Hi,
Do let me know your requirement, may be i can assist you with the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 01:46 PM
Thanks, I figured it out with a bit of help and here's my final script. Any thoughts to make it more efficient?
//Set variables
var userTime = current.variables.when_to_send;
var nowdt = new GlideDateTime();
//Calculate time difference between nowdt and userTime in seconds
answer = gs.dateDiff(nowdt,userTime, true);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2020 03:14 AM
This looks fine. No changes needed 🙂
On a side note, in future, try to use GlideDateTime.Subtract method. It is more efficient.
Ref: https://hi.service-now.com/kb_view.do?sysparm_article=KB0594663
Mark the comment as helpful if it helps.