I've built a fairly simple workflow that queries a list for specific results; for each result, send email. The workflow is working as long as the query returns at least one result.
Problem: If the query returns zero results, I get the workflow error: Error operating on collection variable. Index property is greater than the number of items in the collection.
Can someone give some advice for how to handle this type of scenario?
- Query List operation returns zero results, stop workflow
Solved! Go to Solution.
One option you can use it the Run If action. You could put the For Each Match inside a Run If action, then configure the Run If action to run if the count is >= 1. That way the For Each Match only runs if there are one or more results.
Another option is to use the Filter option before the For Each Match. You can configure the Filter to only continue the workflow if there are one or more results.