SmashedMonkey
Scholar

Using repeating section UDA takes very long time to run though

Jump to solution

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:

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

SmashedMonkey_1-1637688040136.png

The history list shows all the data has been captured:

SmashedMonkey_2-1637688083922.png

Here is the workflow, using Vadim's UDA.

SmashedMonkey_3-1637688233788.png

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

SmashedMonkey_4-1637688341166.png

and here is the loop config...

SmashedMonkey_5-1637688381214.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 🙂

 

 

 

0 Kudos
Reply
7 Replies
jeff
Apprentice

Re: Using repeating section UDA takes very long time to run though

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

0 Kudos
Reply
SmashedMonkey
Scholar

Re: Using repeating section UDA takes very long time to run though

Jump to solution

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.

SmashedMonkey_0-1637746154992.png

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.

0 Kudos
Reply
MegaJerk
Collaborator

Re: Using repeating section UDA takes very long time to run though

Jump to solution

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. 

View solution in original post

Reply
SmashedMonkey
Scholar

Re: Using repeating section UDA takes very long time to run though

Jump to solution

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

SmashedMonkey_0-1637834809695.pngSmashedMonkey_1-1637834869147.png

SmashedMonkey_2-1637834954769.png

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.

0 Kudos
Reply
jeff
Apprentice

Re: Using repeating section UDA takes very long time to run though

Jump to solution
Ah, thanks for this. I learned something!
0 Kudos
Reply
kunalpatel
Collaborator

Re: Using repeating section UDA takes very long time to run though

Jump to solution

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

0 Kudos
Reply
SmashedMonkey
Scholar

Re: Using repeating section UDA takes very long time to run though

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