cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Auto-delete Item from a Document Library

Jump to solution

I am using a WF to take a custom form and convert it into a Word document using a Word template with content controls.  Then, I convert the Word doc to a PDF (both of which are saved in a SharePoint library).  At the end of the WF, there is a delete item action to remove the Word document from the library and leave only the PDF.

Both documents are created, but the delete action causes an error and does not delete the Word doc.  Seems to be a permission issue, but I am a Site Owner with Full Control.  Any ideas on how to get the delete action working?

0 Kudos
Reply
9 Replies
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

You might want to try adding a pause before the delete. I think we had a similar problem and it's because the workflow was trying to delete it too quickly. Try giving it some time to convert to the PDF first.

If that doesn't work, what does your configuration look like for the Convert document and the delete item?

0 Kudos
Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

I'll test the Pause action right now.  Thanks for the suggestion!

Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

Ok, I tried up to a 20 min pause, and still it won't delete the word document.

The PDF is showing up in the doc library 10-15 min before the pause ends and the WF errors.

I have a 'configure action - update document' action that pulls in the word template and matches all the content controls with fields from the form.  Then, it outputs to a WF variable that is the Word Doc URL.

Then, I convert document from VAR:  textDocxURL to VAR:  textPDFURL.  This works fine, and the PDF appears in the library next to the word doc.

It ends with the delete item action that attempts to delete the textDocxURL path doc:

The WF errors at this point, and does not delete the Word doc.

0 Kudos
Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

Try adding a "Commit Pending Changes" after you create the PDF.  This could be an issue with the way the workflow processes the actions.  See this document for details. Designing your Workflow - Commit Pending Changes Action NW2010 & NW2013

0 Kudos
Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

Hi,

I am pretty new to Nintex WFs but have run into a similar issue trying to match a URL variable using a similar functioning Workflow. My error messages were not quite the same (my errors gave no details at all other than 'error').  In my case the WF is designed to take a .docx in a library and convert to PDF in another Library then 'update item' the new PDF for certain fields. For the convert process I build a variable for the output file (similarly to yours) with the intent (originally) to match the converted PDF's URL to this string for the update selection parameters.

At first I thought it might be some syntactical issue with how the URL strings were built (i.e. perhaps there were differences due to truncation/server relative paths, or issues with spaces (%20) or punctuation in file/Library names) I tried many variations but never could get it to work. One thing I would have liked to have tried but never did get around to would be testing with a library/site without spaces. I would be curious to know if your Library/Site names are space free or not.

In the end I built a string just for the filename and then matched on that criteria. Not as robust as I would have liked but it worked for now. It would be interesting if there is a solution out there to make this technique work, or at least an explanation of why it doesn't work.

SB

0 Kudos
Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

One more suggestion.  Add a Log in Workflow History action before your delete and capture the URL Path field and your textDocxURL to see if those match. 

Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

Added Commit Pending Changes, but no change.

I know how to log info in the WF and capture the textDocxURL, but how do I capture the URL Path field? 

0 Kudos
Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

I misread your screen shot above.  You would just need the textDocxURL variable since that is what you're searching for.  Compare that to the actual document url for the word doc you're trying to delete and see if they match. 

Reply
Workflow Hero

Re: Auto-delete Item from a Document Library

Jump to solution

I figured out why this wasn't working for me.

I was using a Regular Expression action to generate the final URL path of my Word doc and the final PDF.  I pasted in the URL from the 2 doc libraries where I wanted these documents to land.  I saved these URLs to a WF variable.  These variables then became the document names for my Word and PDF documents after they were generated, and I used them to select the URL path of the Word doc in my Delete Item action that was failing.

I noticed a small difference between my Word URL and my PDF URL.  One had changed the spaces in the doc library name to "%20" and the other had not.  The one that kept the spaces was able to update the item, the one that changed the space to "%20" caused an error.  I manually changed every instance of "%20" to a space in my regular expressions, and it works now. 

Even though pasting either of the final URL results below into a web browser took me to the correct document, for whatever reason, Nintex wouldn't accept the former.

Example: 

Not Working -  https://www.sitename.com/Document%20Library%20TempDocs/Filename.docx

Working -  https://www.sitename.com/Document Library TempDocs/Filename.docx

Reply