0

While creating a picklist or a multipicklist it is unrestricted by default.How do I change the picklist to a restricted picklist?

2
  • When do you mean by restricted? When and who should it be restricted for?
    – Girbot
    Apr 27, 2015 at 9:03
  • restricted in the sense,it takes only fixed values.Values other than those given in the picklist field will not be saved.An unrestricted picklist can take a value other than those given in the picklist field.
    – Bharath
    Apr 27, 2015 at 9:28

3 Answers 3

1

If you're displaying a picklist field on a standard salesforce page you will not be able to enter any other values apart from the one's available in the picklist. But you can set any values to the picklist if you're setting it from code(apex). AFAIK there's no such setting in salesforce which will prevent it from happening.

To avoid it you can create a validation rule which checks if the value set in the picklist is correct. You could do the same from a trigger if you have some complex logic to allow specific values in special cases.

1
  • We wrote triggers that do this by enumerating the list of options from the field's describe results. This lets us modify the list with configuration, no validation rule or code to maintain.
    – sfdcfox
    Apr 27, 2015 at 17:16
1

When you create a picklist it lets you tick a box to select if you want restricted or un-tick if you want unrestricted one.

Later on you can also see in the picklist options "Restrict picklist to the values defined in the value set" is either ticked or unticked.

0

Set multiselect="false" so it will restrict user from select multiple selection.

apex:selectList

1
  • I didn't mean to restrict user from selecting multiple options,I need a field which does not take values other than those defined in the picklist.
    – Bharath
    Apr 27, 2015 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .