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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Create user defined keyboard shortcut at form using java script

(0) ShareShare
ReportReport
Posted on by 45

Hello All,

I want to create user defined keyboard shortcut example if I press (CTRL + B ) then it should click form specific button.

I found one java script code from MS community but, I do't know where to write and how to write. Could someone explain me formCommandAttribute with some examples.

below script I found from MS community

Shortcuts: { Name: { Keys: { modifier1: true, modifier2:true, keyCode: $dyn.ui.KeyCodes.* }, // Only specify the modifiers you need // (between alt, ctrl/meta, shift) Handler: function (evt) { // Code to handle shortcut. }, // Additional code. }

Thank & regards

Anand

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi Anand,

    The documentation from Microsoft can be found here: docs.microsoft.com/.../keyboard-shortcuts-controls

    It might help you. In the menu, you can find also documentation about how to build an extensible control.

  • Blue Wang Profile Picture
    on at

    Hi Anand,

    The FormCommandAttribute is applied to a method in your control class, which allows the method to be called from a control’s JavaScript class.

    docs.microsoft.com/.../extensible-control-programming-reference

    A tutorial explaining how to implement extensible controls:

    bootes.co/.../Extensible-Controls-in-Dynamics-365-for-Finance-and-Operations-Tutorial

  • Anand Agarwal Profile Picture
    45 on at

    Hello All,

    Thank you so much for reply.

    I tried all links it looks difficult in case of KeyDown

    I started to learn Java script, it looks possible but I could not find the call stack of below java script.

    Shortcuts: $dyn.extendPrototype($dyn.controls.Form.prototype.Shortcuts, {

        InvokeDefaultButton: {

            Keys: { keyCode: $dyn.ui.KeyCodes.enter },

            Handler: function (evt) {

                this.executeShortcuts(false, "InvokeDefaultButton");

            }

        },

    })

    It would be very helpful for me if you can provide some code sample related to HotKey and KeyDown symbol.

    Do you have any sample code for KeyDown function ?

    Thanks

    Anand

  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi Anand,

    Apart from the documentation provided above, I'm not aware of any code example. I don't have it available as I never used this part.

  • Anand Agarwal Profile Picture
    45 on at

    Hello All,

    Thank you so much for referring me below sites.

    Currently, I am able to use keydown functionality with only new controls.

    There are two types of control standard (Form string control) and we can create user defined control (BasicUserEntryControl).

    BasicUserEntryControl : I created new control at form design then written java script code and HTML code, then when I press anything at key board the alert message occur shown below :

    Form string control (AX Input) : This is standard control, If I use standard control then keydown button will not occur.

    Now my question is How can I extend standard control to achieve keydown functionality ?

    In my form I have standard fields as "FormStringControl" I want to implement keydown functionality at formstringcontrol.

    pastedimage1589984886557v3.png

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans