Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Text-Field Input Mask Definition depends on another Field

Posted on by 15

Hi,

is it possible in Dynamics 365 CRM to define the Input Mask of a Text-Field depends on another Field in the Form?

My Scenario is:

- In the Account Form, I have a custom Field for Country and a Text-Field.

- When the User choose a country then the Text-Field should have an Input-Mask

- for each country, the Input Mask is different. 

best regards

Ziad

  • Johao Larios Profile Picture
    Johao Larios 1,795 on at
    RE: Text-Field Input Mask Definition depends on another Field

    Hello,

    You can achieve this also by implementing a javascript. If you need to save the data with the actual mask, my recommendation is create a text fields and then modify it values accordingly using javascript: 

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/attributes/getvalue --->to obtain the value for the fields, you can use this one to get the value from the field that will determine what mask use as well. 

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/attributes/setvalue --->to set the actual value. 

    Yo may need this one as well: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/attributes/fireonchange 

    Hope this information helps to achieve your goal.

  • Ziad Eltoufeili Profile Picture
    Ziad Eltoufeili 15 on at
    RE: Text-Field Input Mask Definition depends on another Field

    Hi Marco,

    thanks for your response. It works fine. I am searching to find a solution for this Format: 6 digits (1 Sign (+/-) or the Character A) 3 digits e.g.: 123456A123 or 123456+123.

    best regards

    Ziad  

  • Marco.P Profile Picture
    Marco.P 2,405 on at
    RE: Text-Field Input Mask Definition depends on another Field

    Hi Ziad Eltoufeili,

    Any news? Did you try mi proposed solution ?

  • Suggested answer
    Marco.P Profile Picture
    Marco.P 2,405 on at
    RE: Text-Field Input Mask Definition depends on another Field

    Hi,

    If i were you, i would:

    • create two text field with their own input mask.
    • make those two field hidden
    • add a business rule that check the value in country field and show only the right input mask field

    Also refer to this to make mask control validation:

    https://www.inogic.com/blog/2017/02/controls-in-dynamics-365-for-mobile-app-input-mask/

    Hope it helps,

    Marco


    If you found the answer helpful for you or other readers, please mark as Verified.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans