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
Anil ChunduAnil Chundu 

Validation rule for address fields are not empty

Hi all,

I have two different addresses in Contact .
OR( 
ISBLANK( OtherCountry ) , 
ISBLANK( OtherState ), 
ISBLANK( OtherPostalCode ) , 
ISBLANK( OtherStreet ) )


((ISBLANK(BillingCountry) ), 
(ISBLANK(BillingState) ), 
(ISBLANK(BillingPostalCode) ), 
(ISBLANK(BillingStreet) ))

If user entres one of those addresses then validate all the values are filled or empty.
suppose if user enters billing city then remaining billing fields are empty that time validation rule should fire and shows the error message billing address fields should be filled. In this case other address fields shouldn't be validated.

If user enters both addresses then both validations should chck for both addresses.

If he enters only other addresses that validation should check for other address fieldsonly not for billing addresses fields.

Please let me know for clarification.

Thanks
Vivek DVivek D
If you want to do this using validation rule only then
Use 2 formula field to set True or false based on any of the address, for example if all blank then true and if all populated then also true otherwise false it will look like something
OR(
AND(ISBLANK(BillingStreet),ISBLANK(BillingCity),ISBLANK(BillingState)),
AND(NOT(ISBLANK(BillingStreet)),NOT(ISBLANK(BillingCity)),NOT(ISBLANK(BillingState)))
)
You can add other fields also and you can use this formula field in your validation rule. If the value is false then show error for respective address. 
 
Vivek DVivek D
Sorry I did little overthinking here you can create 2 validation rule for each address type and use the above formula. That way you will be able to show custom error message for both address type
(no need to create extra formula fields)
Anuj PatelAnuj Patel
You can use an If statement here.


IF( OR(AND( ISBLANK(TEXT(picklist1)), ISBLANK(TEXT(picklist2)), ISBLANK(text1) , ISBLANK(test2) ),AND( NOT(ISBLANK(TEXT(picklist1))), NOT(ISBLANK(TEXT(picklist2))), NOT(ISBLANK(text1)) , NOT(ISBLANK(test2)) )), FALSE,TRUE )


PLease let me know if it worked out.


You can always mark it as the best answer if it helps.:-)