Hi Srikanth,
You can handle this by matching each Status with its DueDate using the same index array, then filtering only the OPEN items.
Simple logic steps:
-
Get today's date
-
Loop through the arrays
-
If Status = OPEN, check its DueDate
-
Use DateTimeDiff to compare DueDate with today
-
Keep the date with the smallest positive difference
In Genesys Cloud, you can use DateTimeDiff like this:
- DateTimeDiff(ToDateTime(DueDate[i]), GetCurrentDateTime(), "days")
- You may need to augment the DueDate format to be compatible with the above logic, you can this within Genesys itself via updating the variables required.
This will return:
So you can ignore negative values and from the remaining ones select the smallest value. That will give you the closest upcoming OPEN due date, even across month-end or year changes.
------------------------------
Josh Coyle
Senior Professional Services Consultant
------------------------------