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)

addOnKeyPress Event on dynamics 365 mobile app

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • gdas Profile Picture
    50,091 Moderator on at

    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 }


  • Community Member Profile Picture
    on at

    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
    50,091 Moderator on at

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

  • Suggested answer
    Rhett Clinton Profile Picture
    Moderator on at

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

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    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

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