2

Was hoping someone could help with the following:

I would like to prevent a user from Converting a lead that does not have 1. at least 1 alpha character (upper or lower case) - (A-Z) or (a-z) 2. Or at least one numeric character (0-9) & and least one Alpha character (A-Z) (a-z). Does not need both just one or the other (1 or 2).

I am trying to add this validation to the Company field on leads to prevent conversion of leads with companies that have any special characters.

I believe it would look similar to this but this is not working the way I described it above.

AND( IsConverted, NOT(REGEX(Company, '[A-z]+')) ) OR AND(IsConverted, NOT(REGEX(Company, '[A-z]+'), NOT(REGEX(Company, '[0-9]))), )

1
  • Thanks, I had that setting turned on, however I don't believe my formula is correct.
    – J.Y.
    May 19, 2015 at 13:50

2 Answers 2

1

You can use this regular expression to meet your requirement :

^(?=.*[a-zA-Z])(?=.*\d).+$

Where

^               - Start of String
(?=.*[a-zA-Z])  - use positive look ahead to see if either lower or uppercase exists
(?=.*\d)        - use positive look ahead to see if number present
.+              - gobble up the entire string
$               - End of string

You nmay need to enable validation rule capability on lead conversion by contacting salesforce support.

2
  • Thanks, I had that setting turned on, however I don't believe my formula is correct. How do I en corporate what you provided into my validation rule?
    – J.Y.
    May 19, 2015 at 14:18
  • Put it inside your REGEX function.
    – Adrian Larson
    May 19, 2015 at 14:19
0

There is a setting for what you want. It is called "Require validation for Converted Leads." You may have to contact support to enable it.

1
  • Thanks, I had that setting turned on, however I don't believe my formula is correct. – J.Y.
    – J.Y.
    May 19, 2015 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .