0

Im trying to figure out a Validation Rule IF Picklist Value is "Yes", then 4 fields must be filled out AND at least 1 of 2 Solution Partner fields must be Filled out. I can figure out how to require all fields, but Im getting stuck on how to add additionally at least 1 of 2 Solution Partner fields have to have values.

AND( $RecordType.Id = "0125p000000eVI2", ISPICKVAL( Picklist_Field,"Yes")

&& OR( ISBLANK(Main_Contact__c), ISBLANK(Services__c), ISBLANK (Contact_1__c), ISBLANK(Decision_Maker__c) )

&&

OR( ISBLANK(Solutions_Partner1__c ) || ISBLANK(Solutions_Partner2__c))

(this last Part is where I get an issue) if set up like this, Im able to save without either of the Solutions Partners

1 Answer 1

1

Either use an OR function or || operator, correct syntax for both would be:

  1. OR(Condition1, Condition2)
  2. Condition1 || Condition2

Whereas you have written it as OR(Condition1 || Condition2), that is not valid.

Indenting formulas can be extremely helpful in finding some trivial issues with syntax. This is an example of formula with AND/OR functions to improve readability-

AND(
    $RecordType.Id = "0125p000000eVI2", 
    ISPICKVAL( Picklist_Field,"Yes"),
    OR( 
        ISBLANK(Main_Contact__c), 
        ISBLANK(Services__c), 
        ISBLANK (Contact_1__c), 
        ISBLANK(Decision_Maker__c) 
    ),
    OR( 
        ISBLANK(Solutions_Partner1__c),
        ISBLANK(Solutions_Partner2__c)
    )
)

Note: I may have made a mistake in converting operator or in conditions, please check.


Edit: Seems you need a XOR condition, replace the OR condition with below:

(ISBLANK(Solutions_Partner1__c) != ISBLANK(Solutions_Partner2__c))
2
  • But how do I ensure that only 1 of 2 Solutions Partners in the 2nd OR condition is required? at the moment with your formula it requires both
    – kikalz
    Commented Apr 14, 2021 at 9:30
  • You perhaps need a XOR condition, try replacing that OR condition with (ISBLANK(Solutions_Partner1__c) != ISBLANK(Solutions_Partner2__c)), that is equivalent or a XOR gate.
    – Raul
    Commented Apr 14, 2021 at 9:40

You must log in to answer this question.

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