Skip to main content
Olivia Forde (Lifes2good) 님이 #Sales And Marketing에 질문했습니다
I want to validate a field with a different format dependign on the value ina pick list shoudl I use a case o or if statement

 

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개
  1. 2015년 6월 22일 오후 12:01
    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}"))

    )

     

     
0/9000