Ask Search:
Avni PatelAvni Patel 

How to restrict users typing free text in a picklist field?

Hi,

I have had a look around validation rules and pick list but i'm not to sure which would be the best to use.

Our Subject field is a picklist, however users can still type free text. This is causing problems when running a report as not all data is accurate.

I would like to implement a validation rule to only allow the picklist value to be selected and no option for free text.

Could someone please help me?

Many thanks

Avni
Best Answer chosen by Moderator (salesforce.com) 
Steve MolisSteve Molis
You might also want to consider losening it up to allow them to amend the Subject Line for Emails:

AND(
Subject <> "Supplier Visit / Call ",
Subject <> "IBC Visit",
Subject <> "Phone Call",
NOT(BEGINS(Subject, "E-Mail"))) 

All Answers

Ashish YadavAshish Yadav
picklist is a drop down list how can anybody write in a picklist.
Avni PatelAvni Patel
For some reasone the pick list on the subject does not appear as a drop down it has a magnify glass to show it is a pick list.

A custom field which i created as a picklist appears as a drop down.

Not sure if it is because it is pre-defined field.
Steve MolisSteve Molis
Try adding a VR like this:

AND(
TEXT(Subject) <> "Call"
TEXT(Subject) <> "Email"
TEXT(Subject) <> "Meeting"
TEXT(Subject) <> "Other")
KC ShaferKC Shafer
Task subject is odd sort of field, it looks like a lookup, is called a picklist and behaves like text is formulas. To validate that only the supplied values are used, use a validation rule like this:

NOT(OR(CONTAINS( Subject ,"Call"),CONTAINS(Subject,"Email")))

You can continue adding values and replace for call and email, but the idea is that if it does not contains call or email, throw an error. 

--KC

edit: Steve's will work just as well, just remember to add the commas for the and function :]
Avni PatelAvni Patel
Hi SteveMo & KC

Thanks for your feedback it has been very useful.

I have just entered the following:
AND(
TEXT(Subject) <> "Supplier Visit / Call ",
TEXT(Subject) <> "IBC Visit",
TEXT(Subject) <> "Phone Call",
TEXT(Subject) <> "E-Mail")
 

It comes up with an error message: Error: Incorrect parameter for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Text

Subject is a picklist. Not sure where i am going wrong i'm not the greatest with formula's could you help further?

Steve MolisSteve Molis
Damn it!  that's what I get for winging it...  

This one should do it:

AND(
Subject <> "Supplier Visit / Call ",
Subject <> "IBC Visit",
Subject <> "Phone Call",
Subject <> "E-Mail") 

KC ShaferKC Shafer
Makes sense, just remove the text function, as these fields are already evaluated for formula purposes as text:

AND(
Subject <> "Supplier Visit / Call ",
Subject <> "IBC Visit",
Subject <> "Phone Call",
Subject <> "E-Mail")
 

--KC
Steve MolisSteve Molis
You might also want to consider losening it up to allow them to amend the Subject Line for Emails:

AND(
Subject <> "Supplier Visit / Call ",
Subject <> "IBC Visit",
Subject <> "Phone Call",
NOT(BEGINS(Subject, "E-Mail"))) 
This was selected as the best answer
Avni PatelAvni Patel
SteveMo & KC Thank you soo much for your help it works now :)

Your help is much appreciated.

Many thanks

Avni