Flow designer wait for condition is not working

SHALIKAS
Tera Guru

I have the below script for wait for condition action 


 var dec_date =fd_data._2__get_catalog_variables.decommission_date;
var nowTime = new GlideDate();
if(dec_date<=nowTime)
{
    answer = true;
}
else answer =false;
While logging nowTime and dec_date the format for both is coming as yyyy-mm-dd. 
But the flow is not waiting
8 REPLIES 8

Satishkumar B
Giga Sage
Giga Sage

Hi @SHALIKAS 

try using GlideDateTime instead of GlideDate for accurate comparisons

 

// Convert the decommission date to a GlideDateTime object
var decDateTime = new GlideDateTime(fd_data._2__get_catalog_variables.decommission_date);

// Get the current date and time as a GlideDateTime object
var nowDateTime = new GlideDateTime();

// Compare the two GlideDateTime objects
if (decDateTime <= nowDateTime) {
    answer = true;
} else {
    answer = false;
}

 

 

…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution !! If this helps you to understand.

…………………………………………........................................................................................

Still not waiting , 
while logging dec_date and nowTime it is coming as
today date 2024-07-31 07:55:46 and dec_date is dec date2024-08-03 00:00:00
bit the wait for condition is not waiting

 

Hi @SHALIKAS 

SatishkumarB_0-1722414876056.png

 

Yes, the dec_date will be of future only, so will it not compare the future date?