I have a workflow with an special requirement. All the possible users that are going to participate in the workflow are going to be in a SharePoint group. This workflow have several sequence tasks, but every task need to be assigned to the user (who belongs to the group) who has the fewest number of pending tasks. I have several workflows in the site and each workflow has his own task list, so I cannot query the task list directly. The user could have some tasks form other workflows assigned.
I need to query this user before create each task, so I was thinking in doing this in a common user designed action.
I am searching for some advice about the most efficient way of doing this, because this action is going to be used frecuently.
Can anyone suggest to use a CAML query from code? Does anyone think it is going to have poor performance in this case (several tasks lists and I only need a count of the pending changes for each user)?
Is there any place in the nintex workflow database where I can find this information?. What query i should use?