Offboarding workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 03:55 PM
I am trying to do an offboarding workflow. The requestor enters a date when they want the account to be disabled. I wait for to check that that date is today or earlier. Then I have a second wait for to wait until 18:00:00. When I did test tickets yesterday selecting yesterday, it waited until 1800 no problem and then created the tasks. When I did one yesterday and selected today's date, it is still sitting on the first wait for condition to be met. What am I missing?
First wait for condition:
Second wait for condition is a script:
// Set 'answer' to the number of seconds this timer should wait
// Set 'answer' to the number of seconds this timer should wait
answer = (function(){
var gdtToday = new GlideDateTime();
//var gdtTomorrow = new GlideDateTime();
var gdtCOB = new GlideDateTime();
//gdtTomorrow.addDaysLocalTime(1);
gdtToday.addDaysLocalTime(1);
gdtCOB.addDaysLocalTime(1);
// gdtTomorrow.setDisplayValue(gdtTomorrow.getLocalDate() + " 04:00:00"); //careful, there's a leading space before 04:00:00
gdtCOB.setDisplayValue(gdtCOB.getLocalDate() + " 18:00:00"); //careful, there's a leading space before 18:00:00
//calculate wait time
var wait = gs.dateDiff(gdtToday.getDisplayValue(), gdtCOB.getDisplayValue(), true);
return wait;
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 01:53 AM
Hi @erin-marie
The Reason it's stuck when selecting today's date is because the first wait is passes, but the second wait is likely for 6 PM tomorrow, not today - due to that addDaysLocalTime(1), that's the reason behind it .
Kind Regards,
Dushyant Sirohi