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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Validation Rules: Enforce format in fields

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Community Member Profile Picture
    on at

    Hey,

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

    Thanks

  • naZir Profile Picture
    850 on at

    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");

           }

       }

    }

  • naZir Profile Picture
    850 on at

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

  • HowlingWolf Profile Picture
    95 on at

    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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans