WF that Fails to Start - How to avoid duplicates

  • 16 January 2019
  • 5 replies
  • 3 views

Badge +9

I have a WF that creates ("Create New Item") about 400 items nightly to a List.  The WF runs nightly from the Nintex scheduler.  Occasionally I get an error that says "Failed to Start".  The problems is even though I get the message "Failed to Start" it appears that it really did run and it also appears that automatically a "Retry" occurs.  Thus, in my case the items are getting duplicated whenever a "Failed to Start" occurs.  My question is

How do I have the WF not attempt to restart if the Failed to Start occurs.

Also, a totally separate question is if the WF successfully does run then how can I trigger another WF to run but again only if WF1 was completed successfully...


5 replies

Userlevel 5
Badge +14

this use to happen if workflow right after the start gets into a long running action (eg. a loop).

which as well seems to be your case.

add a pause action at the very beginning to wait for short period of time.

Also, a totally separate question is if the WF successfully does run then how can I trigger another WF to run but again only if WF1 was completed successfully...

you may eg start wf2 directly from within wf1, somewhere at the end.

or you may make an update on an item from wf1 where you want to run wf2 (wf2 should be configured to start automatically on item update).

or you mat set some specific flag field to a specific value and let the wf2 run conditionaly once the flag field value gets updated to that specific value.

Badge +9

That appears to have worked, but can you explain why.  If I have a loop that takes 40 minutes then why does a Pause (3 minute pause put on) prior to the loop starting fix the issue.

Also, I notice since putting in the Pause the Workflow definitely completes, but it always end with a generic error "An error has occurred in WF1".  Note all items were created as expected.  There were no issues.  The detail i see on the WF Msg is:

(Note the WF schedule was set up for 5:05 PM and my Pause was set for 3 minutes)

5:08 Pausing for 3 minutes

5:42 Pausing Complete

5:42 An error has occurred on WF1

Userlevel 5
Badge +14
That appears to have worked, but can you explain why.

have a look on this blog that explains effect of pause action and why it may have (maybe surprisingly) a positive effect

Defensive Workflow Design Part 4 - Slow Down and Speed Up 

Also, I notice since putting in the Pause the Workflow definitely completes, but it always end with a generic error "An error has occurred in WF1".

is it a for each loop?

or a regular loop?

do you have disabled 'safe looping'?

I haven't seen it documented anywhere  but it looks like if you have a long running action in a workflow (such as a loop) workflow itself doesn't/cannot report its status to the sharepoint or sharepoint cannot determine workflow status. hence it reports an error.

the other point is that you may generate within loop such a big batch of actions that sharepoint cannot handle it. it then errors out the workflow, often even before the loop finishes.

to avoid this it helps if you put a pause action into the loop as well. it need not pause after each loop iteration, it's sufficient to pause once after X iterations. however, there is no good/recommended value of X, it's different case to case, it may work well for you once in 200 iterations, but it may well be as well 20 iterations. you will have to tune suitable value for your scenario,

Badge +9

The error occurs after the entire For Each (sorry I said loop before) completes so in my case each night after the 490 rows have been created I receive the error, but as mentioned above all ran fine.  The expectation is that 490 rows get created and indeed 490 rows get created.  

Also this is a For Each - not a Loop and thus I do not see a disabled "safe looping"

Userlevel 5
Badge +14

basically it  doesn't matter too much whether it's regular loop or for each loop.

as mentioned, try to add a pause inside a loop (once in a while).

Reply