I have this slow SITE workflow a co-worker created. I know it can be faster. It takes about 6 minutes and I believe it is because it keeps looking up items inside a loop. First off, I'm working with Nintex and SharePoint 2010. All that is supposed to be accomplished in this workflow is to set item permissions in the workflow. The evaluator needs permission to the workflow and other admins. But nobody else. Here is the deal:
1 list used as a lookup:
LU_GovEvaluator - It has evaluator name and competency in it
SAC - It has a field that points to the evaluator lookup. When that evaluator is selected, the competency automatically gets filled in because the competency comes from the lookup as well.
In the workflow, it is looking up the evaluator list. I am trying to prevent that.
Solved! Go to Solution.
can you check the graphical view of the workflow instance put your mouse over the actions to see which ones are taking the longest.
This may give you a better idea of what to look for.
My guess, is that the Set Item Permissions might be the culprit here. But that's just a guess.
The lookup is Government Evaluator. There is also another lookup Competency Code which is hidden. They both point to a lookup list that has the Government Evaluator name and Competency Code.
Loops inside of loops doing queries into lists and setting permissions will always be a taxing and slow operation, especially when all thrown together. Someone could also argue for all that it's doing, its not too bad in terms of speed since it appears this is more of a batch operation than a just in time interaction. I'd say you could rewrite this workflow and perhaps have it fire on items individually at time of modification instead of doing it in batch if you require more real time speeds, but I as well as anyone knows that ultimately your business process will determine if this sort of rewrite is possible.
What my co-worker did was create a site workflow that would be scheduled to run to move items to this list. After the items are moved, it calls this particular workflow which sets permissions to each item. Because it is pretty much copying the items in one fell swoop, you can't set the permissions then. Although I guess, there could be a workflow for when items are added. The question is will that be any faster?
Actually, it looks like the
For Each Competency loop runs 5 times total
The For Each SAC loop runs 108? times overall during its 5 times activation
For all of that to take 3 minutes and 4 seconds - that is really fast!