Flow Design wait for condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 01:08 AM
I am working on a flow design where I have created a step 'wait for condition'.
In that 'wait for condition', I have to check a date time field value is after 45 days as compared to current date.
Can anyone please help me out how can I do that. It is urgent requirement.
Thanks&Regards,
Abhisek Chattaraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 01:50 AM
Hey,
Im not sure if this might work, but give it a try. Maybe you can try using the scripting field in the conditions. And try running this code:
// Replace 'your_date_time_field' with the actual name of your date-time field.
var currentDateTime = new GlideDateTime();
var targetDateTime = current.dateTime; // Get the date-time field value.
// Calculate the date 45 days from now.
currentDateTime.addDays(45);
// Check if the target date-time is after 45 days from the current date-time.
targetDateTime.after(currentDateTime).
Let me know if this works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 02:14 AM - edited 09-15-2023 02:15 AM
Hi Abhisek,
I will check but I don't think the wait for condition action can work that way for a date time field. (because of the way it evaluates or compares the dates or something)
I think you actually need to do an If condition, wait for a period of time using the timer/wait action, loop and recheck with the same if condition again. (so you basically keep periodically checking if it's passed the condition or not, keep in mind there is a limit to the number of loops that can take place so you don't want to do it too regularly.
Alternatively if your scenario is checking that the date time field is 45 days in the past, you could trigger a flow when the date time field is populated, then set it to wait for 45 days,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 02:52 AM
Hi Rhodri,
The scenario is checking the date time field in 45 days future.
Thanks&Regards,
Abhisek Chattaraj.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 06:54 AM
So I was wrong, the wait for condition does actually work:
This flow sets the follow up date on the RITM to be 12 mins from the start time of the flow. It then raises a task, after that task closes it waits until the follow up date is before 10 mins from the current time. So I think it will work as long as you use "relative" in the condition, I think if you use "is one field before/after another field" it might not work.
. To note:
. If a date changes while the wait for condition is waiting, it still uses the original date Workflow "Wait for condition" based on Due date is not moving forward at the expected date - Support...
. My experience with flow is that things aren't instantaneous, it just processes stuff when it has resource. So my example where it was checking within 10 mins, it took a bit longer.