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...
Answered

Input Mask on Phone field

(0) ShareShare
ReportReport
Posted on by 468

Hi,

We have recently integrated Zoom to Dynamics to allow us to make calls directly from the Contact record using Zoom as the provider, by clicking the phone icon on the Mobile Phone field on a Contact record.

There is an issue with the Zoom integration, in that it will only call if the Contact mobile phone record has a country code beginning with a + first. So for example it will work if the Contact number is +1 123456 but wont work if the contact number is 123456.

I have been looking at input masks on the Mobile Phone field as a workaround. The vast majority of our Contacts phone numbers dont begin with '+123' The would just begin with 123. Anyway, testing it in the Sandbox. When I create the input mask with the format +353 0000000000, the +353 appears in the Mobile Phone field on the Contact. However the phone icon does not. I know this relates to ticking the Web Phone or Tablet Controls in the form properties. But my question is how to I keep the input mask and the phone icon in the form?

Thanks a lot

Ted

  • TedW Profile Picture
    TedW 468 on at
    RE: Input Mask on Phone field

    Hi Nya,

    Many thanks for your suggestion. Its very useful. However my main issue is I believe with the Zoom code. In your first screenshot above, the is no icon on the mobile phone field. I have the phone icon on the Mobile Phone field, but it only launches Zoom if the Country Code, in the majority of our contacts this will be +353, is before it the number. And the vast majority of our Contacts dont have +353 in the mobile phone field. Im not too sure how I would amend your code to reflect that.

    Thanks

    Ted

  • Verified answer
    Nya Profile Picture
    Nya 29,058 on at
    RE: Input Mask on Phone field

    Hi Ted,

    Are you referring to the phenomenon in the screenshot below?

    pastedimage1650616655498v1.png

    Here is a blog about it which also mentioned this issue:

    6 Custom Controls in Power Apps for Data Visualizations - (crmheidi.com)

    pastedimage1650616900920v2.png

     

    1. You can create a JavaScript web resource.

    Here is the code for a similar case.

    function FormatPhoneNo(executionContext) {
    try {
    var formContext = executionContext.getFormContext();
    var nvsField = formContext.getAttribute("telephone1").getValue();
    var nvsTmp = nvsField;
    if (typeof(nvsField) != "undefined" && nvsField != null) {
    nvsTmp = nvsField.replace(/[^0-9]/g, "");
    switch (nvsTmp.length) {
    case 10:
    nvsTmp = "(" + nvsTmp.substr(0, 3) + ") " +
    nvsTmp.substr(3, 3) + "-" + nvsTmp.substr(6, 4);
    break;
    default:
    alert("Phone must contain 10 numeric digits.");
    break;
    }
    }
    context.getEventSource().setValue(nvsTmp);
    } catch (err) {
    alert(err.message);
    }
    }
    1. Open the JavaScript to the Quick Create Form of Contact entity and click the Form Properties.

     Image

    1. Add the JavaScript to the Quick Create Form and set the Event Handle as the image below.

     Image

    1. Add the function.

     Image

    1. Save and publish the form.

    Then the Phone Number will be masked as the format: (xxx) xxx-xxxx.

    Image

    And if a number which has been input does not contain 10 digits, there will be prompt popping up.

    Image

    You need to modify the code yourself for the specific format.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans