I am building a workflow to delete documents that are 7 days old. Have tried using "Delete Item" and "Delete Multiple Items".
I have a field in the list that calculates the created on date against the current date to get the number of days old. Also have a calculated yes/no field that says if the number days old is greater than or equal to 7 then delete = yes.
When I do a "For Each" action with the "Delete Item" action filtering on items in the list where days old greater than or equal to 7 or delete = yes, one item is deleted even though there may be several that meet the critera.
When I use a "Delete Multiple Items", all the documents are deleted regardless of the specified criteria.
What am I doing wrong here?
I set up a quick test to verify the behavior you are experiencing. I got the solution working by using a normal delete multiple items action.
I suspect your query on the delete may be causing issues. Can you please run the delete multiple items on only the 1 field? Would you be able to provide a screenshot of the list?
As an alternative (not ideal though) you could do a query list, then bind the foreach to the collection. In the foreach, you can do the delete item on the ID of the current item in the loop. As I said, not ideal. You could also test the query by logging it to history to see what results you are getting.
can you post screenshot of both delete item and for each actions?
as well for each action should iterete over a collection variable - post as well screenshot of an action that populates the collection.
can you post action configuration as well.
this should be prefered (more efficient) way how to delete multiple items at once.
a hint: you may test your delete filter/condition with a query list action to make sure it returns expected items.