function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
janeisaacjaneisaac 

Validation rule with AND and OR filters not working

I want the error message to throw if any of the TEXT address fields are completed but the Multipicklist field (Reasons for 201) does not include "Address Change". But it is not working.

 

Any suggestions?

 

AND(  
NOT(INCLUDES( Reason_for_201__c , "Address Change")),
OR(NOT(ISBLANK( Street_Address__c )),
      (NOT(ISBLANK( City__c ))),
      (NOT(ISBLANK(  State__c ))),
      (NOT(ISBLANK( Zip_Postal_Code__c ))),
      (NOT(ISBLANK( Country__c ))),
RecordTypeId = "012C0000000GBZX"
))

 

Thanks!

Jane

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below formula as reference:

 

IF(AND( 

NOT(INCLUDES( Reason_for_201__c , "Address Change")),

OR(Street_Address__c <>'',

      City__c <>'',

       State__c <>'',

      Zip_Postal_Code__c <>'',

      Country__c <>'',

RecordTypeId = "012C0000000GBZX"

)),true,false)

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

kcplusplus90kcplusplus90

When you are making a validation rule, you are defining the criteria for the save to fail. So this says to stop the save if the picklist includes address cahnge and the record type is the one you define and one of the address fields is not blank. Basically all you need to do is remove the nots, change some parentheses and commas. 

 

Try this:

 

AND(  
NOT(INCLUDES( Reason_for_201__c , "Address Change")),
OR(ISBLANK( Street_Address__c ),
      ISBLANK( City__c ),
      ISBLANK(  State__c ),
      ISBLANK( Zip_Postal_Code__c ),
      ISBLANK( Country__c )

),
RecordTypeId = "012C0000000GBZX"
)

Steve :-/Steve :-/

I prefer to use $RecordType.Name instead of Id

 

AND(
$RecordType.Name = "The RecTypeName"
TEXT(Reason_for_201__c) <> "Address Change",
OR(
ISBLANK( Street_Address__c ),
ISBLANK( City__c ),
ISBLANK(  State__c),
ISBLANK( Zip_Postal_Code__c ),
ISBLANK( Country__c )))