Offboarding workflow

erin-marie
Tera Contributor

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:

 

erinmarie_0-1746485670672.png

 

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;

 

})();

1 REPLY 1

Dushyant Siroh
Tera Expert

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