I've been assigned the task of mantaining a site in SP 2010 which was not developed by me. I've recently found out that one site workflow fails because it tries to delete an item which sometimes doesn't exist.

I would need to add an action prior to deletion to check whether the list item exists or not, but I haven't seen any action in Designer which would allow me to perform this.

Any advice?

  • What are the workflows steps and conditions? Jul 3, 2014 at 13:16
  • The workflow is really simple. There is only one step and one condition. The workflow determines whether the item should be deleted or not based on an item's information. But I would like to include a second condition and that is checking if the item exists or not. Makes sense?
    – Gonzalo
    Jul 3, 2014 at 13:28

3 Answers 3


I've done this in the past using a workflow variable as a middle-man of sorts. Try this:

  1. Create a workflow variable that's a string or item ID
  2. Set the workflow variable to the ID of the item you're checking for
  3. Use the variable as your condition - if it's empty, the item doesn't exist

You could also use an integer variable with a default value of "0", then for your condition check if it still equals "0" after the second step. Personally, I prefer strings because they're nice & easy with no pesky validation or type mismatch to worry about.

P.S. - The rest of your workflow would go after this (ie - if variable is empty, stop workflow, otherwise proceed to Step 2 etc.).


You can also download the free activities from : http://www.virtosoftware.com/sharepoint-workflow-activities-kit.aspx#3 - expand conditions


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:

  1. Create a workflow variable, e.g., "Found", as a string
  2. Using an action, set the workflow variable to the result of a lookup (Data source: Current list, field: ID, conditions are whatever you want)
  3. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.