Solved

Using repeating section UDA takes very long time to run though

  • 23 November 2021
  • 7 replies
  • 50 views

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:

20730i717D307CE2446D20.png

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...

20731i53CB4A6F8D7D9D25.png

The history list shows all the data has been captured:

20732iD762FB626B8E8274.png

Here is the workflow, using Vadim's UDA.

20733i88400DEBB419796A.png

The configuration of the Query XML seems to be OK, at least it is recovering the data:

20734i85864709995510C1.png

and here is the loop config...

20735i1333B24A1BCE01D9.png

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 🙂

 

 

 

icon

Best answer by MegaJerk 25 November 2021, 05:34

View original

7 replies

Badge +7

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.

Userlevel 5
Badge +14

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.

Badge +7
Ah, thanks for this. I learned something!
Badge +12

@SmashedMonkey instead of using loop, the most convenient method to extract information from repeating section is as below:


 



  1. Create a plain text MLT column in SharePoint

  2. Connect your repeating section to this MLT

  3. In your workflow, using Query XML and above MLT column as XML source, extract all the field values you need and store them in a collection variable

  4. Using any one collection variable, for loop and Index variable

    1. Now for each collection variable use respective collection operation and using index variable from for loop get the value and store it in the respective type of workflow variable




This way no need of:



  1. Publishing UDA

  2. Safe Looping

  3. Waiting on a timer job


Just my 2 cents.

Thanks @kunalpatel, in the end, I went for the non-UDA solution, and as a result, the workflow runs almost instantly. 🙂

Reply