- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2015 05:51 AM
We have a scenario where we need a workflow to pause until at or after the next occurrence of 4:00 AM. When a network account request is completed, we want to wait until after the new user record is inserted into service-now (4:00 AM) before kicking off the other items on the request.
Any suggestions on how to set up an activity that will always wait until the next occurrence of <time>?
EDIT: The end goal here was to wait until a new sys_user was inserted from AD, which I have done using my below solution. It turns out using a wait for or timer is not the best way to accomplish this but a timer solution that works has been marked as the correct answer.
I am checking if there is more than one sys_user matching last name and created in the last day. If yes I continue, if no I wait an hour and repeat.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2015 03:00 PM
You can use a "Timer" activity with the "Timer based on" field set to "Script":
And this would be your script:
// Set 'answer' to the number of seconds this timer should wait
answer = (function(){
var gdtToday = new GlideDateTime();
var gdtTomorrow = new GlideDateTime();
gdtTomorrow.addDaysLocalTime(1);
gdtTomorrow.setDisplayValue(gdtTomorrow.getLocalDate() + " 04:00:00"); //careful, there's a leading space before 04:00:00
//calculate wait time
var wait = gs.dateDiff(gdtToday.getDisplayValue(), gdtTomorrow.getDisplayValue(), true);
return wait;
})();
The script calculates the number of seconds before 4:00 am the next day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2019 08:53 AM
Could you please suggest me.
Request should not proceed until after 5:00pm if request is entered between 7am-5pm.
Please let me know the possibilities.