Flow Designer: How to check if the end date and time field is less than 24 hours?

velvizhisujatha
Tera Contributor

Hi Team, 

I'm migrating a workflow to flow designer and not able to move forward with the below step. 

Having two variables "Start Date & Time" , "End Date & Time". 

In workflow, we find the difference of the two variables and compare them

If the difference > 24 hours, the timer waits for a day prior to the end date and triggers a reminder notification. 

How do I compare that 24 hours in flow designer? I'm not able to get greater or lesser or a text field to enter the value. 

Can someone help? 

I tried it as, if start variable +24 hours using fx function is not end variable, then trigger the notification. 

 

1 ACCEPTED SOLUTION

update line 4 as this -> don't use getDisplayValue()


    var dur = GlideDateTime.subtract(glideStart, glideEnd);

    var hour = dur.getByFormat('HH'); //get hour part

    if(hour >= 24)
        outputs.moreThan24 = true; // no quotes
    else
        outputs.moreThan24 = false; // no quotes

})(inputs, outputs);

View solution in original post

11 REPLIES 11

please share complete script and complete screenshot of the flow action

also what are the dates start and end

For testing purpose, I have kept it as 1 hour, 

 

find_real_file.png

find_real_file.png

did you check what came in logs for both the dates?

Did you pass those correctly?

what is the type of those 2 input variables

Regards
Ankur

Since output type is true/false

just set true and false and don't set 'true' and 'false' in quotes

update line 4 as this -> don't use getDisplayValue()


    var dur = GlideDateTime.subtract(glideStart, glideEnd);

    var hour = dur.getByFormat('HH'); //get hour part

    if(hour >= 24)
        outputs.moreThan24 = true; // no quotes
    else
        outputs.moreThan24 = false; // no quotes

})(inputs, outputs);