I went to far with my scenario, let me make it more generic.
I have a loop that cycles every 5 minutes with a maximum of 100 iterations.
If the loop hits the max iterations, by default the next task is executed.
I need to capture the fact the loop hit the max as I cannot have the next step execute, I need to stop the process and send a notification.
As there is not an option to use a condition on a loop, nor is there an option of "on max loop do this", I have come up with one kludge but I don't like it because of the requirement to enter the max loop twice. There is also a flaw where the loop criteria is actually met on the last iteration, I will still notify of max loop.
Create two user variables:
MaxLoop as Int32
LoopCounter as Int32
Task SetUserVariable - initialize MaxLoop, to the same value you used in the loop itself
Task SetUserVariable - initialize to 0
Start Loop
Task Calculate Variable - Increment LoopCounter by 1
End Loop
Task Calculate Variable - JobVariable(LoopRemainer_ = (MaxLoop minus LoopCounter )
On Success - If LoopRemainder = 0 then max count hit, send max count notification and stop job.
This is not always accurate though, in the case where the loop criterial is met on the last iteration.
Task