1

I am trying create a validation rule to make sure only certain values are accepted in a Multi-Select picklist when an another field's value.

For example

Value of choices__c(Multi-Select picklist) should only be choice1, choice3 and choice5 if value of Family__c(formula field of text type) is X. If the value of Family__c is anything else other than 'X' choices__c can be anything.

I am really not sure how do i equate the Multi-Select picklist value with text formula

2
  • you should use INCLUDES -- help.salesforce.com/… like: IF(NOT(Family__c=='X'),false,IF(OR(INCLUDES(choices__c,'<not alloved 1>',..,INCLUDES(choices__c,'<not alloved n>', true, false));
    – kurunve
    Jun 22, 2016 at 8:56
  • Oh great.. that makes sense. if you can add it as a answer i can accept it
    – Prady
    Jun 22, 2016 at 9:18

1 Answer 1

1

EDIT 1 If you want to allow any value of choice1, choice3, or choice5 but do not want to allow choice2, choice4, or choice6 then you should create rule like this

 if(Family__c == 'X', 
        if( 
            OR(
                INCLUDES(choices__c,'choice2'), 
                INCLUDES(choices__c,'choice4'),
                INCLUDES(choices__c,'choice6')
            ), 
            True, 
            False
        ),
        False
    )

You can use formula something like bellow:

if(Family__c == 'X', 
    if(TEXT(choices__c) == 'choice1; choice3; choice5', 0, 1),0)

So basically the idea is to check the value of Family__c.

If value of Family__c Is X Then check additional condition else return false.

The additional condition should check if Text value of choices__c is 'choice1; choice3; choice5' then it should return false or else true.

When validation rule returns true it shows error to user and stop the processing.

3
  • It doesnt necessarily need to be all three choices, it could be anyone or a combination of any of the three. @kurunve 's comment answers it with usage of Includes
    – Prady
    Jun 22, 2016 at 9:47
  • ok, it was not clear in OP. Any ways updated the answer. Jun 22, 2016 at 11:44
  • The formula has to be: AND( Family__c = 'X', OR( INCLUDES(choices__c, 'choice2'), INCLUDES(choices__c, 'choice4'), INCLUDES(choices__c, 'choice6') ) )
    – o-lexi
    Jun 22, 2016 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .