function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
greg777greg777 

Validation rule for Event - Subject field

I trying to setup a validation rule so it forces the users to only select from the picklist and not type in whatever they want. Here is what I have so far but it gives me an error.

CASE(Subject,
"CPAP Trial", "CPAP Trial",
"Pressure Change", "Pressure Change",
"Mask adjustment", "Mask Adjustment",
"Equipment Adjustment", "Equipment Adjustment",
"CPAP Purchase", "CPAP Purchase",
"Supplies", "Supplies"
"APAP Trial", "APAP Trial",
"APAP-CPAP", "APAP-CPAP",
"Download", "Download",
"Other", "Other"
"Call", "Call"
"Email", "Email"
"Meeting", "Meeting"
"Send Letter/Quote", Send Letter/Quote"
"None")

Error Message:
"Please select items from picklist"
NPMNPM

Even though evey where you look Subject is identified as a Picklist type field every where you look in setup and in inserting the field in formulas it really is not.  It is a combo box thatappears to be treated like text.  For a validation rule the idea is to have the rule evaluate to "True" whe the record Save is attempted.  Try a formula that follows this pattern.  Substitute your values

NOT(OR(Subject  <> "text", Subject  <> "text2",Subject  <> "text2"))

 

greg777greg777
Still allows me enter regular text with no error message.
NPMNPM

May be because my logic is wrong - I have 2 negatives.  Need to get rid of the Not( ) to make ther rule evaluate to True if Subject is not equal to one of the text values.  We did get past the syntax errors, right? 

OR(Subject  <> "text", Subject  <> "text2",Subject  <> "text2")

greg777greg777
Works. Thank you VERY much.

Greg
NPMNPM
ddegradoddegrado

This is great, I had the same question! However NPM can we take this one step further by just saying, Subject <> Any picklist value?

 

The reason I ask is because what if you are adding more values to your picklist, deleting some, or changing others.

 

I've been looking every where to find something that will represent all values in a given picklist, force the user to select anyone one of them whether there are 10 or 100, and NOT allow the user to type what ever he/she wants in the subject field (or any other field for that matter).

 

Thanks again for your answer thus far, which I'll use but as picklists grow what does one do?

 

I read else where that you can use the new TEXT () function, but I was not successful. That is probably due to my "newbie" status, but I do want to learn and appreciate any insight you or anyone else can provide.

 

Thanks! 

ddegradoddegrado

Very odd this actually didn't work...

 

Oh well I found this to work for me (I wonder why?):

 

 NOT(OR( 

Subject = "Call", 
Subject = "Email", 
Subject = "Visit"))