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
SaaniaSaania 

Checking if any picklist value has been selected.

Hi,

we have a checkbox named 'On Behalf Of', which when checked should have a value in the picklist named 'On Behaf of user'.

I already have a field dependency set to show the picklist values only when the checkbox is checked, but we need to make sure that the user selects something in the picklist ( and not just leave it as --None--).

The validation rule I was using is:

Code:
AND(On_Behalf_of__c , IF(  ISPICKVAL( On_Behalf_of_User__c, "none") , FALSE, TRUE)).

 


But this prevents the users from saving the data, even when they have a valid value in the picklist. I think the problem is the "none" part in the picklist, so how should one check to see if the picklist has a value other than --None--.

Thanks,

NPMNPM
I first thought try checking for null rather than none to see if the actual value is really null not none. 
You want your validation rule to trigger when the formula evaluates to TRUE.  
Try this: 
      ISPICKVAL(On_Behalf_of_User__c, "")
 
     
 
SaaniaSaania
Thanks for the suggestion, but I had already tried it, didnt work ...

Thanks
NPMNPM

Wow,  I tested a validation rule for a picklist to make sure the record can not be saved unless there is a value from the pick list entered and it works. The rule formula being just the following:

          ISPICKVAL( Test_Values__c , "")

and it works for me. 
 
Maybe something else is needed with a dependent picklist?
NPMNPM
It is important to have ""  for the null not " "
SaaniaSaania
Thanks NPM, the problem was with the false, and true in the IF statement. the order should have been reversed, and the "" worked.

Thanks a bunch for the help.