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
jgreene.ax1178jgreene.ax1178 

Zip Code Validation Rule

Hi all!

Trying to make a validation rule on the Lead Object that would throw an error whenever the zip code is not equal to having 5 numbers in it. 

Right now I have this:

LEN(Postalcode)<>5

However, this throws an error whenever the zip isn't filled out - I need it to trigger whenever that zip code field is filled out but isn't 5 numbers.  

Thanks for any help you can give!
Best Answer chosen by jgreene.ax1178
Scott McClungScott McClung
AND(
 NOT ISBLANK(PostalCode),
 LEN(PostalCode)<>5
)

All Answers

kevin Carotherskevin Carothers

What about this?

OR(ISBLANK(ZipX__c), LEN(ZipX__c) < 5, LEN(ZipX__c) > 5)


Scott McClungScott McClung
AND(
 NOT ISBLANK(PostalCode),
 LEN(PostalCode)<>5
)

This was selected as the best answer
jgreene.ax1178jgreene.ax1178
Thanks so much Scott!!  That works perfect!
sandeep reddy 37sandeep reddy 37
i was used this AND(

 NOT ISBLANK( pin_no__c ),

 LEN( pin_no__c )<>5

)
 but it shows  Error: Incorrect parameter type for function 'LEN()'. Expected Text, received Number what can i do mr scoot