Dynamics 365 Business Central: Create a shortcut key to automatically enter data (Data Entry Shortcut Keys)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about an interesting topic, how to create a shortcut key to automatically enter data (Data Entry Shortcut Keys) in Business Central.
This is a question I saw in the Dynamics 365 Community two weeks ago. More details: Custom Shortcut Keys (dynamics.com)

Has anyone programmed custom hot keys/shortcuts within Business Central?
As an example, in a purchase invoice have a hot key to input a set GL account, item number, description, etc.

Custom Shortcut Keys (dynamics.com)

Okay, keyboard shortcuts aid accessibility and can make it easier and more efficient to navigate to different areas and elements on a page.
First let’s take a look at the shortcut keys in BC. There are the standard shortcut key combinations that we can use when we’re working with Business Central.
Dynamics 365 Business Central Mini tips: Keyboard Shortcuts:

In the code of the page, we can also use the ShortcutKey Property to add a new shortcut key.

ShortcutKey Property: Sets a shortcut key for selecting a menu item.

Applies to:

  • Page Action
  • Page Custom Action

Syntax: ShortCutKey = ‘Shift+Ctrl+D’;

For example, page 30 “Item Card”:

And starting with Business Central 2023 wave 1 (BC22), we can use KeyTips on the page.
Business Central 2023 wave 1 (BC22) new features: Access actions and navigation menu efficiently with keyboard (KeyTips)

But you can find that the above methods are all for actions (menu items). It is not possible to create shortcuts for automatic data entry directly. However, we can simply change the idea, if the code in the action is automatically entered into the data, then it is possible to add a shortcut.

Let’s see a simple example.
I added a new action on the Item Card page to enter a set of data.

After clicking, the value is automatically entered.

Test video:

Then I added a shortcut key for this action, ‘Ctrl+F6’.

Let’s test it again. I completed the input of a set of data without clicking any action and only using shortcut key.

Of course, this can also be done with KeyTips, but you need to find the position of the action, which I personally find inconvenient.

In addition, if you only want to use shortcut keys, you may consider not promoting the action.
PS:
1. What is Promoted action and How to Promote action?
2. Promoted action groups, action references, and ShowAs Property (New Modern Action Bar)

Great! Give it a try!!!😁

Test code:

pageextension 50100 ItemExt extends "Item Card"
{
    actions
    {
        addafter(CopyItem)
        {
            action(AutomaticDataEntry)
            {
                Caption = 'Automatic Data Entry';
                Promoted = true;
                ShortcutKey = 'Ctrl+F6';
                PromotedCategory = Process;
                Image = Entries;
                ApplicationArea = All;
                trigger OnAction()
                begin
                    Rec.Validate(Description, 'Automatic data entry');
                    Rec.Validate("Item Category Code", 'CHAIR');
                    Rec.Validate("Shelf No.", 'SHELF-1');
                    Rec.Validate("Unit Volume", 100);
                    Rec.Modify(true);
                end;
            }
        }
    }
}

PS: If you only target certain functions, you can use the standard method. For example,
1. Use new templates with same flexibility as configuration templates (Customer, Vendor, Item, and Employee Templates)
2. How to create recurring orders (Recurring Sales Lines and Recurring Purchase Lines)

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL