1

Multiple users are moving files into my library, and no one cares about the actual document file name, but SharePoint does. So to prevent overwriting "duplicates", I'm using a workflow which appends "Random Text" to whatever the SharePoint ID is. This works half the time. I tried it with an "Update Item" action on Path and Name and a "Set Field = " action on Name, but the same inconsistency occurs.

To remedy this, I tried the "delay for __ seconds" trick by calculating 1/60 (1 second) as my delay variable and setting the pause for "delay" minutes. This makes the workflow run without errors 100% of the time, but the process is taking 2-3mins (maybe longer) to complete than it did before I added a pause.

Is there a more efficient way to pause the workflow? Is this just an altogether poor solution?

  • 1
    I would use an Event Receiver to handle that quick appending of random text to a field. Implement the ItemAdding or ItemAdded events and do the update. Can you deploy an event receiver where your solution is hosted? – lwbecker2 Mar 6 '14 at 18:56
  • Yes I can do sandboxed solutions. Thank you for this suggestion. I will most likely go with something like this. – user3299197 Mar 6 '14 at 19:10
2

If you pause the workflow, it gets picked up again the next time the workflow timer job runs. So even if you set it for a fraction of a second, it is effectively paused until the next time the timer job is set to run. The default configuration is 5 minutes I believe and it can be altered via powershell to reduce the time to a minute.

  • Thank you for your explanation. This is very helpful. We have a separate architect team that would have to approve that request, so I'm not sure I can change that. – user3299197 Mar 6 '14 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.