Skip to main content

Hi,

Here is my requirement:

I have a SP list. Where, I have a choice field in this list with choices category 1, category 2, category3 and a participant name field.

Now the constraint is: category should only be used 30 times in the list. After which, it should not be able to create a list item with same category.

Is this possible with Nintex Workflow?

Please advise

Thank you.

Since a workflow can only start after an item is created, your specific request is not possible in terms of preventing an item from being created.  However the workflow run and determine if an item was the 31st item with a category, then delete it and send the user a notification. 

If you wanted to prevent the creation of an item all together, you would need to build a custom form that would hide a category from being used if it were more than 30 times during the creation of a record.


you could create a validation rule and query the list for all the items that meets some criteria, in your case category.

you would need to use lookup() function to get all such items. then length(lookup(...)) will give number of items.

note however, this will not be 100% reliable, since if two or more users will be creating new list entry at about same time, they both/all might see current number of items below the limit. but once they all submit the form you will exceed the limit.

but maybe it will be sufficient in your scenario.


Hi,

Something you may want to investigate (in a test setup) is to:

  • create a simple list "CategoryLookup" with 2 columns:
    • Title to hold the category name (and column name renamed to Category)
    • A lookup (LookupCount) to the list using the Category lookup field.
    • Add you category items
  • Replace in your list the choice field with a List Lookup column "Category" to the new list holding the category values
  • Edit the LookupCount field to use the "Category (Count Related)" field that now exists in your list
  • Create a view "Valid Categories" which only shows categories for which LookupCount < 30

So far, the above will work just fine. The challenge will be to make it work in a Nintex Form as well. A List View control using the "Valid Categories" view will show you only the items matching the filter criterium (count < 30). However, using this view in the List Lookup will render the dropdown empty sad.png (because the "Category (Count Related)" value is calculated when rendering the view; in the past you could, however, create SP charts based on this value). So maybe you can get it to work with a Lookup() function or custom JavaScript.

Although it's not a working answer (yet), it may get you on a track that may result in a working solution.

KR


Another option would be to create a workflow that runs through all list items, counting the used categories and update a numeric column in the Categories list. If I'm correct, filtering the lookup control on this column (or use a filtered Categories view) should work. Downside is the workflow overhead (in case of large numbers of items/categories) and Category list availability (locking by workflow)


hi Jean,

I will try all the approaches. However, please note that i am not using Nintex Forms. I have to achieve this without Nintex. 

Thank you,


No problem. In which case you might want to look into my 2nd reply. You can a calculated column in your Categories list that only displays the Title when the LookupCount (filled by workflow) is < 30, otherwise it shows "".


Reply