web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Field Validations details

(0) ShareShare
ReportReport
Posted on by 50

Can anyone help me on what all validations we have on each field. For Instance: Phone Number should only contain 0-9,- etc.

Where can i get complete list of such validation.

*This post is locked for comments

I have the same question (0)
  • Hosk Profile Picture
    on at
    RE: Field Validations details

    There isn't a right or wrong answer for phone number validation because it based on what numbers you want to allow

    do you include country code

    do you include mobile phones

    do you include the country code infront of the mobile phone number

    will you allow other characters such as brackets etc

    validating phone numbers is not a straight forward problem.  One of the basic checks is to make sure it's a certain length. Probably one of the hardest jobs is to work out exactly what your rules are for validation.

    I think the best way to tackle this is use a javascript function and in that function you can do a number of checks

    before I checked the validation of the number I would remove dashes and brackets and just concentrate on validating the number.

    You could then validate the first part of the phone and check it's an international code. If it wasn't an international code then you could check it was a valid mobile

    I would then use regular expression to check it was the a certain length

    If the validation is to difficult you may want to make the users select a drop down for country/mobile

    here is some javascript I created to validate uk mobile

    javascript:void(0);

    function checkUKTelephone(telephoneNumber) {

      /// <summary>

      /// validates a uk mobile phone number

      /// </summary>

      // Convert into a string and check that we were provided with something

      var telnum = telephoneNumber + " ";

      if (telnum.length == 1) {

          telNumberErrorNo = 1;

          return false

      }

      telnum.length = telnum.length - 1;

      // Remove spaces from the telephone number to help validation

      while (telnum.indexOf(" ") != -1) {

          telnum = telnum.slice(0, telnum.indexOf(" ")) + telnum.slice(telnum.indexOf(" ") + 1)

      }

      // Remove hyphens from the telephone number to help validation

      while (telnum.indexOf("-") != -1) {

          telnum = telnum.slice(0, telnum.indexOf("-")) + telnum.slice(telnum.indexOf("-") + 1)

      }

      // Remove hyphens from the telephone number to help validation

      while (telnum.indexOf(")") != -1) {

          telnum = telnum.slice(0, telnum.indexOf(")")) + telnum.slice(telnum.indexOf(")") + 1)

      }

      while (telnum.indexOf("(") != -1) {

          telnum = telnum.slice(0, telnum.indexOf("(")) + telnum.slice(telnum.indexOf("(") + 1)

      }

      while (telnum.indexOf("+") != -1) {

          telnum = telnum.slice(0, telnum.indexOf("+")) + telnum.slice(telnum.indexOf("+") + 1)

      }

      if (telnum.indexOf("44") == 0){

          telnum = telnum.replace("44", "0");

      }

      var exp = /(070|071|072|073|074|075|076|077|078|079)\d{7,8}$/;

      if (exp != null) {

          //if the regular expression is wrong I don't want to show the user, we can use F12 to debug

          try {

              if (exp.test(telnum) != true) {

                  telNumberErrorNo = 5;

                  return false;

              }

          }

          catch (err) { }

      }

      // Telephone number seems to be valid - return the stripped telehone number  

      return telnum;

    }

  • temp Profile Picture
    50 on at
    RE: Field Validations details

    Thanks Ben for your quick response. But my question is a bit generic. I'm looking for validations that are implemented in CRM services, if any.

    I need to know if it has to be handled only at my application (client side) or do we have an additional layer of validation done within CRM services

  • Suggested answer
    Hosk Profile Picture
    on at
    RE: Field Validations details

    what version of CRM are you using?

    The only validation you have is on field type e.g.

    whole number - you can only type in valid numbers

    text

    currency

    There isn't a phone field because phone can use numbers (but isn't a valid number) and characters

    Usually with phone numbers you have to do the validation yourself

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans