Hi, we are using a list in SharePoint to manage our hardware. Now my colleagues had the idea, that it should be possible to add a specific amount of new items to that list with "one click". (to generate consecutive numbers for inventory labels)
The solution I created was very simple... the user can start the workflow, types in the "amount" of items that should be created, and the workflow runs...
- The Loop runs if the variable "amount" is greater than "0"
- then a new list item will be created with some defined single text columns
- then a math operation "subtract 1" from the variable "amount"
- the loops runs again if "amount" ist still greater than "0"
- and so on, and so on.
It works fine, with only one problem... the loop takes so much time to run. (varies from 2 - 8min)
Is there any way to make this loop task faster? Because.... when my colleagues have to add/reserve 50 items the workflow would run 4 hours. Or perhaps there is another way to solve the request to create a certain amount of list items. (Quick Edit isn't the solution I prefer)
Solved! Go to Solution.
please check if safe looping is enabled in your farm. You can enable/disable safe looping in Central Administration -> Nintex Workflow -> Global Settings
You can also disable safe looping for only one single workflow by doing the following:
Whenever you publish a workflow the current global settings will be applied.
if you want to avoid admin changes with every workflow publishing, you have (at least) two other options
- use for each loop instead of loop.
it's a bit tricky,, but you can find the concept described in following bolg post Safe Looping or Not--that is the question
- make direct call of UpdateListItems method of List.asmx webservice. that gives you opportunity to build whole batch of as many rows as you need on your own, and submit it to sharepoint at once.
see web service reference with some examples here Lists.UpdateListItems Method (Lists)
the global Setting for "Enforce Safe Loop" was the solution. Thanks for this advice.
@Marian: I checked your solution. It will surely get the job done, but is a little bit too complicated for this littel/simple request from my colleagues. But thank you, too.