I have a library where there is a workflow that goes through an approval process. When the item is finally approved the document is converted into a pdf.
The word document that lives in the first library will move to a archived status and this is manually changed by the user. They edit the item and then change the status of that item to archived.
What I want to do is when the item is placed in archived the pdf gets deleted in the other library.
I have a workflow that only runs on modification when the item is placed in Archived status. Once it starts this is the action that I configured however it is not deleting the pdf.
Solved! Go to Solution.
I recreated the issue you were having. I also had issues (and errors) when trying to delete the PDF file in the second library using the Name field. I set workflow variables to equal the Name field in both lists and logged those variables to the history list. The values came back as "Filename.docx" and "Filename.pdf". Since the Name fields are different that could be your issue.
You could use a Regular Expression to strip out the file extensions, save those results in workflow variables, and update the Title fields in both lists with those variables. Then you could use the Title fields in your query for the Delete Item action. That worked fine for me and deleted the PDF file in the second library when the status of the Word document in the first library was set to Archived.
Give that shot and see if that works for you.
Just double-check the name field - are you sure this is the field to use? It contains the file extension too, so unless the "NameOfWI" is the same name plus extension, I believe it won't delete the file. Unless I'm misunderstanding your process?
I would use Log in history to check what value "NameOfWI" contains so you know what you are deleting is what you intended to delete.
If delete the pdf file by name does not work as stably as others have mentioned above, consider deleting the pdf file by id. (Use query list to get the id of the target pdf and then delete it by id)
Hope that helps