For anyone who tried all of this and it errored out on them (like it did with me), here's how I solved it:
When you look up an item and return the ID, but nothing is found, it will return "0" (as a STRING, not as an INTEGER). So, create a local workflow variable that's a string and use an action to set it to the result of your lookup. Then, whenever you want to act based on the item's existence, check to see whether or not that variable is "0" (without quotes, of course).
So, to clarify, here are your steps:
- Create a workflow variable, e.g., "Found", as a string
- Using an action, set the workflow variable to the result of a lookup (Data source: Current list, field: ID, conditions are whatever you want)
- Wrap your logic in an if-branch that checks to see whether or not the value of "Found" is "0" (without quotes), since an item ID lookup will return "0" if nothing was found