1

I'm trying to create a validation rule formula in Salesforce, that uses two picklist fields. If the first has any value selected, the Second picklist can NOT have any value selected. So basically if Picklist "Boiler_Type_Manual__c" is NOT Null and Picklist "Furnace_Type__c" is also NOT null, a validation rule appears: Cannot have both Boiler and Furnace Type selected!

Any help would be greatly appreicated.

  • Do you mean only either of the picklist should be selected and not both? – codebandit Apr 3 '14 at 15:59
  • Yes, exactly. Only 1 or the other should have a value selected. – user7417 Apr 3 '14 at 16:04
  • Can you create some field dependencies? – EricSSH Apr 3 '14 at 16:56
  • Hmmm, so if picklist A Controls picklist B then don't include any values? I didn't think of trying that. I believe the business did want some kind of explanation if a user tried to select both but not sure if it's that important. – user7417 Apr 3 '14 at 17:13
  • Thanks to everyone for their input and assistance. I was able to use highfive's solution successfully. – user7417 Apr 3 '14 at 19:14
-2

This youtube video gives a quick tutorial on exactly how to use Picklist fields in a Validation Rule. https://www.youtube.com/watch?v=5otBBMmDhyk

| improve this answer | |
6

Use ISBLANK on your picklist fields, after using TEXT to convert them to a text format.

AND(
    NOT(ISBLANK(TEXT(Boiler_Type_Manual__c))),
    NOT(ISBLANK(TEXT(Furnace_Type__c)))
)
| improve this answer | |
  • You don't need to wrap that in an IF statement; just use the AND. – Mike Chale Apr 3 '14 at 19:07
  • Glad to help you. Agreed @Mike Chale, just noticed that. – highfive Apr 3 '14 at 19:10
0

This formula might work out for you IF( AND( TEXT(Boiler_Type_Manual__c) <> null,TEXT(Furnace_Type__c)<> null) , true, false) .This allows only one picklist to be selected and not both.

| improve this answer | |
  • Thanks but unfortunately it is still no firing. Curious: what is the true,false at the end for? – user7417 Apr 3 '14 at 17:09
  • In which scenario is the validation rule not firing. True is returned if both picklist values are not null on which validation rule will be triggered, else false is returned. – codebandit Apr 3 '14 at 17:11
  • It doesn't fire when I select a value in both picklists. – user7417 Apr 3 '14 at 17:30
  • Is it not firing when you try to save your record? – codebandit Apr 3 '14 at 17:31
  • No, it is not firing at all. – user7417 Apr 3 '14 at 17:45
0

If possible I think you should explore trying to create field dependencies..

These links may help you.

https://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_dependent_picklists.htm

http://help.salesforce.com/HTViewHelpDoc?id=fields_defining_field_dependencies.htm&language=en_US

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.