Hi, I have been trying to use the impressive UDA workflow that was developed by Vadim Tabakman, some time ago, I think. I have a SharePoint 2016 farm with Nintex Forms and Workflows for SharePoint (on-Prem). I have developed a form to capture overtime information for staff, which includes a repeating section that contains the data for each overtime shift worked. I downloaded the UDA and the associated workflow from Vadim's blog and configured everything as guided in the blog (which has now moved I believe, but the screenshot images have been lost, sadly).
I got this working as a test with the workflow just writing out the results to the history log. What I am finding, is that if the list item contains a single item in the repeater (i.e. no repeat), then the workflow runs through instantly. If, however, there are 2 repeats, then the workflow takes about 5 minutes to complete. With 3 it goes up to about 8 mins. If this is scaled up to the sort of real world usage, then the workflow will take hours per list item, or probably timeout or fail.
I created a smaller test form with some of the basic fields as shown here:
I used some calculated values for the dates and times, so that I could format them for output, the actual outputs of the date pickers and the drop-downs are not being output in the workflow. When I run the workflow on the item in the screenshot, it runs instantly and I get the result in the list...
The history list shows all the data has been captured:
Here is the workflow, using Vadim's UDA.
The configuration of the Query XML seems to be OK, at least it is recovering the data:
and here is the loop config...
Can anyone think of a reason why this takes so long to process a list item that has more than a single repeat item? Is there an alternative way of doing this without the UDA or a more efficient way that will work a lot faster?
Thanks in advance 🙂
Solved! Go to Solution.
In my experience, that Loop action is just incredibly slow and I avoid it whenever possible. One loop cycle will run then the workflow just sits there for several minutes before the next cycle kicks off. I don't understand what you're looping through here, but if there's any way you can use a For-Each instead of the loop I think you'll be much happier.
That's interesting. I did wonder if the loop was causing the performance issue. Basically, the UDA is called in the workflow and that decodes the XML chunk that the form repeating section produces. It then gets stored into a variable called textRepeatingSection, and another variable stores the number of child items in the repeater as an index.
A separate variable called numIndex is then set to 1 to begin the count of iterations through the loop. Then the loop continues to process while the number of children is greater than the count value, and stops when they are equal. In the loop, I just have an XML query, that uses XPath to recover the desired element values from the array stored in the textRepeatingSection variable and then the log action just outputs the values into the log.
So, I guess the For-Each action needs to approximate what the looping is doing. I will see if I can reconfigure that part of the workflow to see if the performance improves.
I read in another post, that using the internal FormData in the UDA is less reliable than using the list lookup to recover the XML chunk for processing. I will look at that, once I have the looping working better. Thanks for your suggestion.
I suspect that the reason this is happening is because you have Safe Looping turned on
To quote the article: "Enforce safe looping (enabled by default): Automatically adds a hidden delay at the end of each iteration of a loop action (Loop only) if the child actions are not guaranteed to cause the workflow to stop and wait. This delay can cause a 2- to 7-minute pause between each run of the loop. Delays are added when the workflow is published; to see the change in behavior, republish existing workflows that use loop actions."
Additionally: "For Nintex Workflow for SharePoint 2016, safe looping can be enabled/disabled via Central Administration > Nintex Administration > Security"
Turning this off should solve your problem without needing to rework anything.
OMG! It's nobbled by design! Thanks @MegaJerk for this solution. I removed the safe looping option and (after a 15 minute wait), republished the workflow and ran it on an item with 5 repeats. The workflow finished instantly.
Ironically, I had also redesigned another workflow to use an XML query into a collection, and then within a for-each loop, I recovered all the other fields using collection operations set to Get. Here is my alternative solution, which does not use the UDA...
It works just as well, and I picked up some threads on this board, that suggested that UDAs will not be available, or may not work in the Online versions? Nevertheless, I am happy that both solutions now work. Thanks also to @jeff for his suggestion of the For-Each loop. That has worked well.
@SmashedMonkey instead of using loop, the most convenient method to extract information from repeating section is as below:
This way no need of:
Just my 2 cents.