6

I have a list defined with a column called "Priority". The Priority column is a choice column where the list of choices is defined as: 1,2,3,4,5 and None. This effectively defines a list item as being one of the top-five priorities or as being unprioritized.

I would like my users to be able to set the priority for multiple items in the list to "None" (i.e. many list items might be unprioritzed). I would also like to restrict my users from being able to assign multiple items in the list at priority 1,2,3,4 or 5 (i.e. we can't have two items as the top priority).

I've looked at column validation, list validation, workflows and I can't find any way to make this happen. Is it possible in SharePoint Foundation?

1
  • Per is giving the right answer.
    – Optimus
    May 16, 2012 at 5:12

2 Answers 2

2

There are a couple ways you can do this but they aren't really "out of the box" because these are your own custom rules.

Add some JavaScript to your New/Edit forms

If you are familiar with JavaScript, this is probably the easiest method since you don't need to deploy any code to the server. You can edit the forms to use jQuery or Prototype.js + SPUtility.js (library maintained by me) or your custom code.

Note: this is purely client side validation and will not be enforced by the server unless you implement an event receiver. This means you could still change it via Datasheet view for example. Which leads to...

Write a custom event receiver

Bust out Visual Studio and code up a custom event receiver to validate the values. You can throw an error if the user chooses a value which is invalid or simply throw away their change to the field. You would probably override ItemUpdating to do the check and there are tons of great examples out there.

Other..

You could also try using a workfow, or maybe a custom infopath form but I don't really recommend those.

3

The only solution not involving code is:

Create the column as:

  • Choice
  • Not required
  • Unique
  • Choices: 1, 2, 3, 4 and 5 (not None)
  • Drop-Down Menu
  • Clear default value

enter image description here

That'll allow the users to create any number of entries without a priority, but only one for each of the 5 values.

This seems is like you want it to work. BUT once an entry has been assigned a priority, there is no way to clear it again.

1
  • Thanks for the response. This is close - except for the fact that "once an entry has been assigned a priority, there is no way to clear it". We might be able to get around that by moving prioritized items out of the main list and into an archive list - but I'll have to investigate this more.
    – pmartin
    May 17, 2012 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.