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
Michael Bos 3Michael Bos 3 

Temp Address - zip code validation

Hello developers,

I need to extend a validation rule on a temporary address with validation check on zipcode and street + housenumber. 

The existing validation rule:

AND( Is_Temporary_Address__c = TRUE, 
     OR( 
     ISBLANK( Temporary_OrderStreet__c ), 
     ISBLANK( Temporary_OrderCity__c ),
     ISBLANK( Temporary_OrderZip__c ),
     ISBLANK( Temporary_OrderCountry__c ) 
     ) 
)

(fields cannot be empty. rather simple check)

The Zipcode validation check:

AND( 
OR( Temporary_OrderCountry__c = "Nederland", Temporary_OrderCountry__c = "Netherlands", Temporary_OrderCountry__c = "NL"),
OR (ISBLANK( Temporary_OrderZip__c), 
NOT(REGEX(Temporary_OrderZip__c , "^([0-9]{4}[\\s]{1}[a-z|A-Z]{2})?$|^[0-9]{4}[a-z|A-Z]{2}+$")
 ) ))
  • Checks the country, and if the zipcode is written as 1234AB or 1234 AB and contains four numbers and 2 letters.
  • This one is not in use.

The Street + Housenumber validation:

This is where it gets tricky.
This is a combined field for street and housenumber.
Some adresses start with a number, but also have a housenumber.
Housenumbers can be just a number (1,25,650,1110) or have a extension (A, 2 hoog).
Should I split these fields?
If so, how?

My questions are:
- How do I combine everything in one validation?
- Is this even possible or desirable?
- How to split fields if this is more desirable?

Thanks for reading and I'm really looking forward for answers from validation wizards :-)
Michael Bos 3Michael Bos 3
Giving this a subtle kick for some visibility.
Hope someone can help me out on this?