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 :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Dynamics 365 input field mask

(0) ShareShare
ReportReport
Posted on by 5

Current CRM is Microsoft Dynamics 365 Version 1612 (9.0.9.4)

Hi, everyone. 

Default input field mask doesn't work on concrete version. 

What is the best way to set input field mask (as phone/email mask) in CRM?

Is it possible to do via javascript and if it is, what steps should I do?

Some cases with jquery and jquery.inputmask doesn't work because of default crm jquery overwrite custom one.

I have the same question (0)
  • hib Profile Picture
    5 on at

    It is all about web version, not mobile/talbet

  • Suggested answer
    Srikanta Mahapatro Profile Picture
    190 on at

    Hi,

    Can you try if the link helps https://community.dynamics.com/.../input-mask-on-d365-control

    Please mark as verified if the answer is helpful.

  • hib Profile Picture
    5 on at

    no, it doen't help, as I said default solution doesn't work with concrete version

  • Suggested answer
    ashish12 Profile Picture
    3,079 on at

    Check the latest notes from D365 in docs about input field mask control.

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    Since "addOnKeyPress" function had been deprecated, we could not match the format when entering each number/letter, but we could use js code to check the value format after we entering the value immediately.

    For example I want to chekc if the email feild format is "xxx@xxx.com" , we could use the following code. We add the function on the emial field's onchange event or form onsave event.

    function formattEmail(executionContext) {
        var formContext = executionContext.getFormContext();
        var Email = formContext.getAttribute("new_Email").getValue();
        var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        if (!reg.test(Email)) {
            Xrm.Page.ui.setFormNotification('Wrong Email format!'"ERROR")
            return false;
        }
    }

    pastedimage1575440314374v1.png

    pastedimage1575440418143v2.png

    As we can see in the above pictures,  this feature works well in both UCI and Classic client.

    About input mask control, I also tried in my instance(Version 1710 (9.1.0.10334) online 2019 wave 2) and it only worked in UCI not Classic client.

    Hope it helps.

    Best Regards,

    Leo

  • Suggested answer
    Shanon012 Profile Picture
    10 on at

    Even I was also experiencing the same issue.The community dynamics forum helped me out in resolving my issue.I have another related
    question in this regard. I am totally unable to log in to Microsoft office 365 in Mac Air.
    I have gone ahead and checked all the configurations and settings and also followed basic
    steps to resolve the issue  login office 365 Please suggest me if I have anything to add on to it.

  • Suggested answer
    hib Profile Picture
    5 on at

    Solutuion is:

    1) Use Inputmask.js

    2) Use method $("#attributeName_i", window.parent.document).mask(maskFormat);

    Special property "window.parent.document" is neccessary because D365 keeps scripts in separate window (frame)

    It should helps

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    Thanks for your sharing and solutions.

    If your question has been resolved, please close this thread to help other more users with simialr issues.

    Best Regards,

    Leo

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 55 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans