I am modifying a process that used to allow our users to upload documents directly into a master document library (which turned out to be a bad idea) so that instead they are uploaded to a separate "in tray" library.
After the incoming documents are reviewed and approved by an administrator a workflow will move the item into the master library.
Now, there is no Move List Item action in Nintex, but that's ok because a Move is simply a Copy followed by deleting the original item- right?
However, when I try this it fails. The workflow copies the current item to the target list successfully, but when I execute the Delete Current Item action-
- An error pops up. this is either a completely unhelpful "An Unexepected Error Occurred" message, or a more scary but more useful Sharepoint internal error stack trace.
- Interestingly, the item is deleted and the workflow exits successfully, it's just the error message shown to the user that is the problem.
The stack trace is hard to read but basically seems to indicate that an operation has been attempted on an unknown list ID (i.e. the one that's been deleted).
I have re-ordered my workflow so that there are no actions trying to reference the list item after it has been deleted, the delete action is the very last one in the workflow before it exits, and there is a Commit Pending Changes action before the delete, however it still causes the error.
I can see possible reasons for this-
- This is a classic Nintex/Sharepoint timing problem (a race condition). Normally I would try inserting a pause before the delete but our Sharepoint site has a timer job issue at the moment so i'm trying to avoid using timer-dependent actions.
- A list item workflow is in effect a child of the list item itself, and this is never going to work, because deleting the item would be like cutting off the branch of a tree while you were sitting on that branch.
If (2) is the case it makes me wonder why the Delete action exists, and its default target is the current list item(!), but then nobody said it had to make sense.
If somebody could confirm if its possible to delete a list item from a list item workflow linked to that item or not that would be very helpful.
Regards: Colin E