Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Validation Rules: Enforce format in fields

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hallo everybody,

I'm searching for an option to validate fields in Dynamics. For example I want to:

- ensure that in an e-mail adress an @ sign is

- ensure that a phone number starts with +

and so on...

How can I solve this?

Best Regards,

Hannes

*This post is locked for comments

  • HowlingWolf Profile Picture
    HowlingWolf 95 on at
    RE: Validation Rules: Enforce format in fields

    Hi, I wonder if you can advise:

    I have an email field with the default validation that works like a charm on the webform, however on the mobile app its coming back with the error if email format is not:

    somethin@email.com.au (dot and two letters). If I enter the email address as something@yahoo.com - it always comes back with "please enter valid email address"


    Is this something to do with the location settings? 

    Thanks in advance

  • naZir Profile Picture
    naZir 850 on at
    RE: Validation Rules: Enforce format in fields

    I dont think it is possible in that way. but you can limit the digit by giving max and minnimum number in business rule.

  • naZir Profile Picture
    naZir 850 on at
    RE: Validation Rules: Enforce format in fields

    You can use this piece of code to validate Phone number.

    Call this function onchange of Phone number field

    function PhoneNumberValidation() {

       debugger;

       var PhoneNumber = Xrm.Page.getAttribute("naaz_phonenumber").getValue();

       alert(vehicleNumber);

       var reg = /Keep Your Mobille number format regular expression here/;

       if (PhoneNumber != null) {

           if (reg.test(vehicleNumber)) {

               alert("Valid");

           }

           else {

               alert("InValid");

           }

       }

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Validation Rules: Enforce format in fields

    Hey,

    Can I use something instead of JavaScript? For example a business role or something like that?

    Thanks

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Validation Rules: Enforce format in fields

    For the email address, just use the Email Address format of the text field. That will add it's own validation.

    For the phone number, create a JavaScript function called validatePhoneNumber(phoneNumber)

    Then there are a few options, you can validate on the OnChangeEvent of each phone number field, or you can validate all the phone number fields on the OnSave event of the form.

    You can use either JavaScript or regular expressions to check the validity of your fields.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans