+ Start a Discussion
mw6mw6 

Validation Rule for Multi Pick List field and a Text field

Field (1) How_did_you_hear_about_us__c has the following values and it is a multi picklist field

Brochure
Bus Advert
EDM [Email]
Events
Facebook
Instagram
Others
Parent Forum
Search Engine
Twitter
Website
Word of Mouth

Field 2 Others_How_did_you_hear_about_us__c is a text field (50 characters)

I am having trouble in writing a validation rule, if 'Others' is selected from field 1, field 2 need to be manadatory.  and if rest of the values are choosen, the Field 2 is not mandatory.  I have a situation if the user select 'Others' and some other options, the record is not able to save, I need some help on this, for example if I choose (Instagram, Others, Parent Forum), I cannot save the record

 
Best Answer chosen by mw6
mw6mw6
I tried the below validation and it works, I will test on your suggestion as well

IF(
AND(
INCLUDES(How_did_you_hear_about_us__c, 'Others'),
LEN(Others_How_did_you_hear_about_us__c) = 0), True, False)

Thanks

All Answers

Subramani_SFDCSubramani_SFDC
whats your current formula?

use this

AND(
          INCLUDES( How_did_you_hear_about_us__c , "Others"),
          ISBLANK(  Others_How_did_you_hear_about_us__c )
 )
Naveen DhanarajNaveen Dhanaraj
AND(
INCLUDES(How_did_you_hear_about_us__c ,"Others"),
ISBLANK( Others_How_did_you_hear_about_us__c ))

 
Subramani_SFDCSubramani_SFDC
if ABOVE not working TRY THIS
AND(
          INCLUDES( How_did_you_hear_about_us__c , "Others"),
          ISBLANK(  Others_How_did_you_hear_about_us__c ),
          OR(
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Brochure")),
​          NOT(INCLUDES( How_did_you_hear_about_us__c , "Bus Advert")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "EDM [Email]")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Events")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Facebook")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Instagram")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Parent Forum")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Search Engine")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Twitter")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Website")),
          NOT(INCLUDES( How_did_you_hear_about_us__c , "Word of Mouth"))
          )
 )
mw6mw6
I tried the below validation and it works, I will test on your suggestion as well

IF(
AND(
INCLUDES(How_did_you_hear_about_us__c, 'Others'),
LEN(Others_How_did_you_hear_about_us__c) = 0), True, False)

Thanks
This was selected as the best answer
mw6mw6
Hi, I have an issue now, the user can input some text in Field 2 and the record can be saved without selecting 'Others' from Field 1.
Need help on how to enable editing of Field 2  only if Field 1 contains 'Others'