Skip to main content
I want to block special characters from being entered in the Account Name, Billing Address, and Shipping Address fields for Accounts. I'm new to validation rules, but I was able to successfully complete this for the Account Name field using REGEX. However, when I started to build the validation rule for the Billing Address field, I got a syntax error: " Error: Incorrect argument type for function 'REGEX()'. "

 

Here is my validation rule for Account Name:

 

NOT(REGEX( Name , "[a-z A-Z 0-9]+"))

 

^^^ This one works fine.

 

Here is my validation rule for Billing Address:

 

NOT(REGEX( BillingAddress , "[a-z A-Z 0-9]+"))

 

^^^ This one gets the syntax error.

 

What am I doing wrong?
2 risposte
  1. 18 ott 2016, 17:17
    REGEX function's first argument has to be text. BillingAddress is not of type Text, it is of type Address ( which is a compound field). Please try using the validation rule something like this to check BillingStreet:

     

     

    NOT(REGEX( BillingStreet , "[a-z A-Z 0-9]+"))

     

    You can do similarly for BillingCity, BillingState, and BillingCountry.

     

    Thanks,

     

    Karthik
0/9000