Thursday, December 18, 2014

How to limit a SharePoint list to one row, with no-code

How to limit a SharePoint list to one row, with no-code

Have you ever wanted to use the functionality of a SharePoint list, but limit the list to only one row?

Did you go into Item Limit in the view, only to realize that you are limiting the number of items to be viewable, not actually limiting the number of items in the list?

I have, and I have come up with a very simple, OOB, no-code solution: Add a column, that is Required, Enforces Unique Values, and give it a Default Value. That’s it!
However, to make it more robust and transparent, you will need to:

    1. Create a site column


    2. Create a List Content Type


    3. Add the Site Colum to the Content Type


    4. Make the column Hidden
Let’s test it out. After adding my content type to a new custom list, I created one record: “Item 23665.” I can see it in the list. Now, I will attempt to add a second list item: “Item 27788”:


After pressing Save nothing happens (the window stays open – you will have to write some code to force it to close). The user must press Cancel to get out of this modal, and the record will not be saved.

I hope you find this helpful.

- Kristin Cameron


No comments:

Post a Comment