Skip to main content
Hi, I'm after your help please.  I have a validation rule for billing address on Account where the City/State/Postcode fields must be completed if the Country = United Kingdom, the Inactive box is not ticked and the City DOES NOT equal either London, Glasgow, Edinburgh,Manchester or Bristol (as we have other rules that will handle those areas).

 

The rule currently looks like this:

 

AND(

 

ISPICKVAL( Account_Country__c , 'United Kingdom')&&

 

Inactive__c <> TRUE,

 

OR(

 

BillingCity <>"London" ||

 

BillingCity <>"Glasgow" ||

 

BillingCity <>"Edinburgh" ||

 

BillingCity <>"Manchester" ||

 

BillingCity <>"Bristol"),

 

OR(

 

ISBLANK( BillingState ),

 

ISBLANK( BillingPostalCode ),

 

ISBLANK( BillingCity )

 

))

 

However, it returns the error message even if the  City is Manchester, like this: Help with AND OR on a validation rule please

 

I don't want it to return an error for this sort of address, only if there are fields missing and the city is not in the list above.

 

Can anyone explain where I've gone wrong please?

 

Many thanks

 

 
1 个回答
  1. 2016年3月3日 10:55
    Got it! (Not my solving, I had help).  Posting the working formula just in case it helps anyone else, I was using OR when I should have used AND:

     

    AND(

     

    ISPICKVAL( Account_Country__c , 'United Kingdom'),

     

    Inactive__c <> TRUE,

     

    AND(

     

    BillingCity <>"London" ,

     

    BillingCity <>"Glasgow" ,

     

    BillingCity <>"Edinburgh" ,

     

    BillingCity <>"Manchester" ,

     

    BillingCity <>"Bristol"),

     

    OR(

     

    ISBLANK( BillingState ),

     

    ISBLANK( BillingPostalCode ),

     

    ISBLANK( BillingCity )

     

    ))
0/9000