I'm putting together a simple workflow that evaluates search results by date and separates entries which were made before and after a cut-off date ("old" entries that still need something done with them versus "new" entries). The cut-off is 7 days prior to the date the workflow was run (i.e. current day's date).
I ran into an odd error, odd in that when I'm dealing with just 1 result, the date comparison works. But as soon as I have more than one, the workflow terminates with the "string not recognized as a valid DateTime" error. So whether I try to do a "For Each Entry" on 2 results or all results, the error happens. But a simple comparison with 1 result won't trigger the error.
Here is the simplified workflow I've been using to test various scenarios and try to find the error:
And here are the formatted tokens, as well as the conditional evaluations for reference:
I save the Creation Date of the current entry when entering the loop:
First conditional statement (the second is the same except, of course, the comparison is greater than or equal to the "7 days before" date):
The date tokens are all tagged as DateTime, which is where I thought the error was coming from at first because I had one or two that were tagged as 'string'. I also tried switching between Date and DateTime, as well as playing with the formatting - in this example I included time as well, thinking perhaps that was the issue but the error remains.
Tracking the tokens produces this result:
The date formats appear to match but the error happens on the first conditional evaluation:
Again, the comparison will work with just one entry, but not more than one. And with that one entry I only had to ensure the date tokens were tagged as Date - having to format them for time or change the month/day order wasn't necessary.
I'm stymied as to why the For Each isn't working. Thanks in advance for any insight into this!