Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Creating custom keyboard shortcuts in Dynamic 365

Posted on by 25

I'm in a company that is upgrading from Crm2011 to Dynamics 365. Our current solution rely heavily on using shortcuts, which is a very important requirement from our users.

We are experiencing problems with adding shortcuts in Dynamics 365 using the Mousetrap-api (https://craig.is/killing/mice) and have tried other api's as well without succes

The shortcuts are added onformload like this, and we are seing the messages "Adding shortcuts" and "Adding shortcuts - done" in the console, but none of the shortcut seems to work

function OnCrmFormLoad(ctx) {
        console.log("Adding shortcuts"); 
        Mousetrap.Add('5', function() {console.log('5'); }); 
        Mousetrap.Add('ctrl k', function() {console.log('ctrl k'); }); 
        console.log("Adding shortcuts - done"); 
}

Are custom keyboard shortcuts not supported in Dynamic 365? or is there another way to add custom keyboard shortcuts?

  • Cinematic Profile Picture
    Cinematic 5 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    I think Microsoft Edge will help you for this. Or visit 10kbeasts for keyboards related queries 

  • Verified answer
    Larsyde Profile Picture
    Larsyde 25 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    So we finally managed to find a solution.

    It appeared that the problem was that clientscript is embedded in an iframe in D365, so the eventlisteners was added to this frame instead of the actual D365 form. By setting the target of the event to the parent of the iframe we managed to solve the problem

  • Larsyde Profile Picture
    Larsyde 25 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    Thanks for your reply. I'm using Chrome, but have tried Edge as well - same result with both browsers.

    I was able to debug Mousetrap.Add (which is actually called Mousetrap.bind - typo :-)). I was able to step all the way through without any inner exceptions. Seems like D365 is "eating" all mousetrap-events - if I replicate the same code in a simple html-page everything works fine

  • Pankaj Gogoi Profile Picture
    Pankaj Gogoi 3,177 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    Which browser you are using? Is it logging any exception to the browser window. Can you debug the Mousetrap.Add function and see if there are any inner exception.

    Good Luck

    Best Regards

    PG

  • Larsyde Profile Picture
    Larsyde 25 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    Thanks - but this is not what I asked for. We are well aware of the standard keyboard shortcuts in D365, but they don't cover our needs

  • Pankaj Gogoi Profile Picture
    Pankaj Gogoi 3,177 on at
    RE: Creating custom keyboard shortcuts in Dynamic 365

    Hi,

    Here are the list of shortcuts for D365.

    https://docs.microsoft.com/en-us/powerapps/user/keyboard-shortcuts

    https://docs.microsoft.com/en-us/dynamics365/business-central/keyboard-shortcuts#keyboard-shortcuts-in-cards-and-documents

    Hope this helps

    Best Regards

    PG

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!

Community AMA December 12th

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

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans