Skip to main content

I wrote a validation rule on Phone number on Lead object which is -

NOT( ISBLANK(Phone) ) && NOT(AND(ISNUMBER( Phone ), LEN( Phone ) = 10 ))

and this validation is working perfectly when I am entering manual record, it is also accepting the records when data is imported through Data Loader. But it is always throwing validation error when I am using Data Import Wizard. In Data Import Wizard when I clicked on view request it is changing the Phone number value from 1230456789 to (123)045-6789 and now validation rule is being fired on this.

2 answers
  1. Nov 20, 2017, 7:15 AM
    hi Aman,

    use below validation rule for your requirement

    AND(NOT(ISBLANK(Phone)),NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}")))

    US Phone Number Has Ten Digits Field Value Validates that the Phone number is in (999) 999-9999 format. This works by using the REGEX function to check that the number has ten digits in the (999) 999-9999 format.

    it will accept both 1230456789 0r (123)045-6789 :)

        i hope it helps you.

          Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others

        thanks

        http://sfdcmonkey.com
0/9000