This si what I want to do
IF (AND(BillingCountry = "United Kingdom",
AND(NOT(REGEX(VAT_Number__c ,"[A-Z]{2}[0-9]{9}")), NOT(ISBLANK(VAT_Number__c ))))
AND
IF(AND(BillingCountry = "Ireland",
AND(NOT(REGEX(VAT_Number__c ,"[A-Z]{2}[0-9]{7}[A-Z]{1}")), NOT(ISBLANK(VAT_Number__c ))))))
The top validation works without the IF when it is on its own.
1 件の回答
Hi Olivia,
I would write separate validation rules for each country that way you can show the error message to the users base on the Billing Country.Your Validation rules will be like below
AND(
BillingCountry = "United Kingdom",
NOT(ISBLANK(VAT_Number__c)),
NOT(REGEX(VAT_Number__c ,"[A-Z]{2}[0-9]{9}"))
)
............................................
AND(
BillingCountry = "Ireland",
NOT(ISBLANK(VAT_Number__c)),
NOT(REGEX(VAT_Number__c ,"[A-Z]{2}[0-9]{7}[A-Z]{1}"))
)