You need to sign in to do that
Don't have an account?

Validation Rule and Using ISPICKVAL
The Picklist has an option to choose -- None --
In my application, I want the user to always choose an item.
I have been unsuccessful in developing a validation rule that puts an Error Message and Does NOT Save the records.
Codes Checked
====
ISPICKVAL(CustomObject__c,"null") in the Debug Log
Values Found: CustomObject__c = null
Result: Pass-Continue
This ISPICKVAL should be true and the Error Message Box Shown
====
Tried the Following ----
OR(ISPICKVAL(CustomObject__c, "Item A"),ISPICKVAL(CustomObject__C,"Item B"))
Value Found: CustomObject__c = Item A
First ISPICKVAL would be True and the Second ISPICKVAL should be so Expression is True
Result: Pass-Continue
====
Changed the "null" to "--None--"
If anyone has any ideas it would be appreciated.
Thank you
The easiest thing to do is to make the field required on the page layout. As a second option, you can try this:
AND(NOT(ISPICKVAL(CustomObject__c, "")),OR(ISPICKVAL(CustomObject__c, "Item A"),ISPICKVAL(CustomObject__C,"Item B"))
If you are only trying to make sure the field always has a value and it doesn't matter which one, this would work:
NOT(ISPICKVAL(CustomObject__c, ""))
All Answers
The easiest thing to do is to make the field required on the page layout. As a second option, you can try this:
AND(NOT(ISPICKVAL(CustomObject__c, "")),OR(ISPICKVAL(CustomObject__c, "Item A"),ISPICKVAL(CustomObject__C,"Item B"))
If you are only trying to make sure the field always has a value and it doesn't matter which one, this would work:
NOT(ISPICKVAL(CustomObject__c, ""))
Thank you Mark.
I used the Picklist as a required field and it bypassed "NONE"
I'm having a simliar problem. I have a picklist "Stage" with 4 statuses the come into play with varifying another field: RFP received, RFP Submitted, RFI Received and RFI Submitted.
There is a second picklist field, Proposal Type, with a defaul vaule of "Pre-Proposal". I am trying to make sure users select a status other than "Pre-Proposal" if any of the above 4 stages are selected.
I created a field to convert the Proposal Type to text but can not get the validation rule to pass the syntax check. Error: Field StageName is a picklist field. Picklist fields are only supported in certain functions.
This is what I tried but it's missing the mark. I wonder if I should have another new field that converts the stage to a text field to get around this or is there a formula that works with otu doing that?
AND (
OR( ISPICKVAL(StageName= " RFP Received", StageName= "RFI Received", StageName= "RFI Submitted", StageName= "RFI Submitted")),
NOT(
CONTAINS("Pre-Proposal", ProposalTypeSub__c )
))
Thanks,
Erik
When building formulas using ISPICKVAL, you can't use the equal sign. The correct syntax is:
ISPICKVAL(FieldName, "Value")
If you click on help when building a formula, it will give you assistance on the correct syntax for each of the functions. It will also have links to some commonly used functions / validation rules that might help in this case.
When trying to catch multiple ISPICKVAL entries in a validation rule using AND or OR, you should use ISPICKVAL repeatedly for each value check. For example:
OR(ISPICKVAL(FieldName, "Value1"),ISPICKVAL(FieldName,"Value2"))
Hi Mark,
thanks for the quick response. I was able to move the formula along a little further but then ran into:
Error: Syntax error. Extra ','
it occurs when there is a comma before NOT but if I take it out I then get an: Error: Syntax error. Extra 'NOT'
AND ( OR( ISPICKVAL(StageName, " RFP Received"), ( ISPICKVAL(StageName, "RFI Received")), ( ISPICKVAL(StageName, "RFI Submitted"))), ( ISPICKVAL(StageName, "RFI Submitted"))),
NOT(
CONTAINS("Pre-Proposal", ProposalTypeSub__c )
)))
Lol, sory about that. i just saw it when I opened you reply.
AND ( OR( ISPICKVAL(StageName, " RFP Received"), ( ISPICKVAL(StageName, "RFI Received")), ( ISPICKVAL(StageName, "RFI Submitted"))), ( ISPICKVAL(StageName, "RFI Submitted"))), NOT( CONTAINS("Pre-Proposal", ProposalTypeSub__c ) )))
I've had good luck with other rules particularly those you mentioned in the online help. this one's less generic and it's tripping me up.
You have extra parentheses before the ISPICKVAL function - they should be:
ISPICKVAL(fieldname, "value"), not (ISPICKVAL(fieldname, "value"))
CONTAINS(fieldname, "string")
Thanks Mark!
For the record I'm posting the code in case anyone needs it.
AND ( OR( ISPICKVAL(StageName, " RFP Received"), ISPICKVAL(StageName, "RFI Received")), ISPICKVAL(StageName, "RFI Submitted"), ISPICKVAL(StageName, "RFI Submitted"), NOT( CONTAINS( ProposalTypeSub__c , "Pre-Proposal") ))
One last question. Sorry.
The workflow to update the Pickiest Proposal type to a Text field is working fine BUT the validation rule we've been corresponding on isn't catching it. I've changed the Stage back and forth to see what happens but nothing unfortunately. Any ideas?
AND ( OR( ISPICKVAL(StageName, " RFP Received"), ISPICKVAL(StageName, "RFI Received")), ISPICKVAL(StageName, "RFI Submitted"), ISPICKVAL(StageName, "RFI Submitted"),
NOT(
CONTAINS( ProposalTypeSub__c , "Pre-Proposal")
))
Hi,
Thanks. I did catch it and change it later on Friday. Still having the same issue with the val. rule not catching though.
The workflow rule does fine in taking the picklist value and copying into the text field ProposalTypeSub_c.
I'm not sure why it's missing it.
I guess the next question is, is there a way to do this or is it just the way the system works and I'm out of luck?
Thanks again.
I think the reason this is such a pain is that I have 2 picklist fields, which is why I have the one picklist value converted to text. The problem is, the rule needs to runs and convert the proposalsub_c each time a record is created/edited so as it moves through the Received/Submitted Stages I can verify the proposal type is correctly set. That means it's writing each time hence the rule to catch it is missing it.
Apparently comparing 2 picklist values is an issue as bet I understand it.