Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

addOnKeyPress Event on dynamics 365 mobile app

Posted on by Microsoft Employee

Hi Folks, 

Is there any way where the addOnKeyPress event can trigger on dynamics 365 mobile app. If yes , Kindly suggest what all do I need to add/ remove from entity or let me know the correct solution. 

*This post is locked for comments

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: addOnKeyPress Event on dynamics 365 mobile app

    The addonkeypress event is now deprecated and will not be supported on the unified interface (mobile included) - the way forwards will be to create a custom control when the framework is out of preview. Until then your only option is to use a custom html webresource in the form.  See docs.microsoft.com/.../webpage-html-web-resources

  • Suggested answer
    RE: addOnKeyPress Event on dynamics 365 mobile app

    Based on the MS article KeyPress methods are not available on mobile clients docs.microsoft.com/.../gg334266(v=crm.8)

  • gdas Profile Picture
    gdas 50,085 on at
    RE: addOnKeyPress Event on dynamics 365 mobile app

    Sorry I have not tried , may be you can try to use onchange then instead of onkeypress.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: addOnKeyPress Event on dynamics 365 mobile app

    Hi Goutam,

    Thanks for the response.

    I have used the same way what you have suggested and things are working fine in desktop. The problem I am facing is, when we try the same functionality in mobile app (Dynamics 365 Mobile App), the script is not getting triggered.

    Do you have any other option ?

  • gdas Profile Picture
    gdas 50,085 on at
    RE: addOnKeyPress Event on dynamics 365 mobile app

    Hello,

    You can add similar way like the way you are attaching form event  in the Main form . Normally when Xrm.Page.getControl("FieldNAme").addOnKeyPress line will execute its automatically attach the function with the field , there is no separate event properties  for that . Here is the few steps you need to follow -

    1. Create a function in a JS webresource and add the line with addKeypress event attach to the control.

    2. Add the JS web resource in the form library.

    3. Register the funtion (onLoadAddKeyPressSample) in the form onload by going to form properties.

    function onLoadAddKeyPressSample()
    {
        Xrm.Page.getControl("FieldNAme").addOnKeyPress(function(){
        alert("Hello World");
        });
    }


    ===============

    OR

    ==============

    function onLoadAddKeyPressSample()
    {
        Xrm.Page.getControl("FieldNAme").addOnKeyPress(YourFunctionName);
    }
    
    function YourFunctionName()
    {
    //Add logic here }


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,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans