TerminateWorkflowByNameForListItem in a loop stopps

  • 11 October 2019
  • 1 reply
  • 3 views

Badge +6

Due to wrong defined Workflows, at my customers site, they have a lot of Workflows which are in Workflowstatus 'In Progress' and did not complete.

I created a Site Workflow with following actions:

Query List to filter all these items.

Iterate over items (having a List Item ID variable)

Calling TerminateWorkflowByNameForListItem with needed settings.

After around 150 items (the Workflows of the items got correctly canceled), the Workflow errord and in ULS-Log I find 'Thread abort exception'

Sometimes the Workflow stopps after 144 items processed or 136 and so on.

Do I hit some sort of limit here?

 

Btw: It would be nice to set the Workflowstatus to Completed when using TerminateWorkflowByNameForListItem.

Please vote for my User-Voice

 

 

 

 


1 reply

Userlevel 6
Badge +22
Try looping in batches of 100 with a pause in between.

Reply