0

I was doing a validation rule on the account object and so far it works and I was able to set the maximum number of characters in the desired field. However I'm not able to set the mininmum amount of characters.

This is part of the validation rule for the maximum amount of characters.

  AND( 
     NOT(LEN((BillingPostalCode)) <= 9),
     1 = CASE(BillingCountryCode, 
     'GB' , 1 , 
     0 ))

I want to set the minumum as 6 but using the code below I wasn't able to do it. Is there anything I could have done differently ?

AND( 
 NOT(LEN((BillingPostalCode) <= 9) || LEN((BillingPostalCode) >=5)), 
 1 = CASE(BillingCountryCode, 
 'GB' , 1 , 
 0 )))

1 Answer 1

0

If you are not going to use this validation rule for multiple counties than no sense to use CASE function. Use ISPICKVAL instead

AND(
    ISPICKVAL(BillingCountryCode, 'GB'),
    OR(
        LEN(BillingPostalCode) > 9,
        LEN(BillingPostalCode) < 6
    )
)

You must log in to answer this question.