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
Marawan ShalabyMarawan Shalaby 

Validation Rules don't fire at all

Hi,
I want to apply validation rules which get checked upon creating an account. But after testing them and trying very basic rules which should always fire, my rules don't fire at all and the Account-Object gets created. They are set active, are syntactically correct. I created them in Customize > Accounts > Validation Rules. The formular basically looks like this:

AND(
OR( BillingCountry = "Canada", BillingCountry = "France" ),
OR( ShippingCountry = "Canada", ShippingCountry = "France" )
)

I know it's supposed to be easy but somehow I can't get it done. Any hint is appreciated, thank you!
Best Answer chosen by Marawan Shalaby
sweetzsweetz
Your rule should be this
AND(
NOT(
OR( BillingCountry = "Canada", BillingCountry = "France" ,ShippingCountry = "Canada", ShippingCountry = "France" )
)
)
If the country is not of Canada or france it will throw an error saying Enter Canada or France

All Answers

sweetzsweetz
Can you please tell me what you are trying to achieve in the validation rule?
Marawan ShalabyMarawan Shalaby
Hi,

I want to validate both country text input fields (both billing and shipping countries as part of the address compound objects) by clicking the "save" button on the "create new account" page. If the user input isn't "Canada" or "France" (example values), the validation rule should trigger and display a "invalid input"-error message without persisting the account object.
 
sweetzsweetz
Your rule should be this
AND(
NOT(
OR( BillingCountry = "Canada", BillingCountry = "France" ,ShippingCountry = "Canada", ShippingCountry = "France" )
)
)
If the country is not of Canada or france it will throw an error saying Enter Canada or France
This was selected as the best answer
Marawan ShalabyMarawan Shalaby
Ok, looks like I derived the formula from the first example (https://help.salesforce.com/HTViewHelpDoc?id=fields_useful_validation_formulas_account_address.htm&language=en_US) in a wrong way. Just added the NOT() and now it's working...

Thanks for your fast support!
sweetzsweetz
Happy to help you :)