1

I created this Validation Rule that when a user selects Yes from the, Any_other_liens_filed_against_you__c picklist but tries to save the record without completing the text field, "If_Yes_What_liens_are_field_against_you__c", the error message will prompt the user to go back and complete the text field.

AND( 
    ISBLANK( If_Yes_What_liens_are_field_against_you__c ), 
        ISPICKVAL( Any_other_liens_filed_against_you__c , "Yes") 
)

What I'm trying to solve is, what if the picklist field, Any_other_liens_filed_against_you__c, doesn't need to be selected BUT a user decides to place any random text into the "If_Yes_What_liens_are_field_against_you__c" text field and is allowed to save the record. This will cause confusion later down the road since the picklist and the rouge text info entered won't relate to each other.

I tried modifying the rule to this and other variations, and the rule just let the record save when the picklist value was blank but included text into the text field.

AND( 
    ISBLANK( If_Yes_What_liens_are_field_against_you__c ), 
      ISPICKVAL( Any_other_liens_filed_against_you__c , "") 
)

I supposed I'll need to rewrite my original VR when No is selected from the picklist too?

What should the validation rule be modified to that will no allow a user to enter text into the text field unless the picklist value has been selected as Yes? and if a user selects No, the text field must contain a value.

3

I think you mean to say and if a user selects No, the text field must NOT contain a value.

OR(AND(ISPICKVAL( Any_other_liens_filed_against_you__c,"Yes"),ISBLANK( If_Yes_What_liens_are_field_against_you__c )),
    AND(ISPICKVAL( Any_other_liens_filed_against_you__c,"No"),NOT(ISBLANK( If_Yes_What_liens_are_field_against_you__c))),
    AND(ISPICKVAL( Any_other_liens_filed_against_you__c , ""),NOT(ISBLANK( If_Yes_What_liens_are_field_against_you__c )))
)

Its basically 3 conditions (with OR):

  1. Yes and ISBLANK(Text)

  2. No and Not ISBLANK(Text)

  3. "" and Not ISBLANK(Text)

  • This is correct but also if none of the picklist values are chosen, the text field should be left alone. However, you might get a user who will randomly enter junk info into an open text field. Would it also be possible to detour a user from saving the record if they are entering random info when the picklist has not been selected with a Yes or No? thanks! – rouqeOne Aug 3 '19 at 12:08
  • @rouqeOne the 3rd option - "" and Not ISBLANK(Text), should handle that situation. Pls let me know if it doesnt? – salesforce-sas Aug 3 '19 at 13:40
  • @rouqeOne, did this solve ? – salesforce-sas Aug 4 '19 at 14:59
  • that did the trick! – rouqeOne Aug 7 '19 at 4:05

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.