Today I created a workflow that needs to delete all documents matching certain criteria in my SharePoint Online based document library.

So I simply dragged in the Office 365 delete items action into my workflow.

 

DeleteItems

Easy! Or maybe not?

In my case my I wanted to delete all documents where a status field was set to Archive.

While I was developing the workflow there was no document with the status of Archive and I found that the workflow gave me an error

Unable to find list item to delete.

Hmm, there are no error handling option on this action and my workflow is falling over.

So I added a query list action to check how many items there are to be deleted.

deletecheck

So by checking if there is anything to delete the error is now avoided and my workflow runs successfully.

Advertisements