web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Setting focus to first field on card page

(0) ShareShare
ReportReport
Posted on by 70

LS,

I created a simple card page and table. When I run this in D365BC the focus is set to the fifth visible field (Preferred language).

No fields are mandatory (I understood D365BC sets the focus to the first mandatory field).

I tried seting the first field as mandatory, but that didn't help.

In this forum there is a solution that uses Xrm.Page.getControl(controlName).setFocus();

But Xrm has bee depreciated plus it uses a function and I cannot create a function in D365BC.

Can anybody tell me how I can get D365BC to set the first field as focused?

My card page:

page 50144 "Staff Card NED"
{
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;
    SourceTable = StaffNED;

    layout
    {
        area(Content)
        {
            group(General)
            {
                Caption = 'Naam:';
                field(RecordNumber; RecordNumber)
                {
                    ApplicationArea = Basic;
                    Importance = Promoted;
                    Visible = false;
                }

                field(FirstName; FirstName)
                {
                    ApplicationArea = Basic;
                }

                field(LastName; LastName)
                {
                    ApplicationArea = Basic;
                }

                field(FullName; FullName)
                {
                    ApplicationArea = Basic;
                    Editable = false;
                }

            }
            group(etc)
            {
                Caption = 'Overige gegevens:';
                field(Email; Email)
                {
                    ApplicationArea = Basic;
                }

                field(PreferredLanguage; PreferredLanguage)
                {
                    ApplicationArea = Basic;
                }

                field(Department; Department)
                {
                    ApplicationArea = Basic;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin

    end;

}

My table:

table 50124 StaffNED
{
    DataClassification = ToBeClassified;

    fields
    {
        field(1; RecordNumber; Integer)
        {
            AutoIncrement = true;
            DataClassification = ToBeClassified;
        }

        field(5; FirstName; Text[50])
        {
            Caption = 'First name';
            DataClassification = ToBeClassified;

            trigger OnValidate()
            var
            begin
                FullName := FirstName + ' ' + LastName;
            end;
        }

        field(10; LastName; Text[50])
        {
            Caption = 'Last name';
            DataClassification = ToBeClassified;

            trigger OnValidate()
            var
            begin
                FullName := FirstName + ' ' + LastName;
            end;
        }

        field(15; FullName; Text[101])
        {
            Caption = 'Full name';
            DataClassification = ToBeClassified;
        }

        field(20; Email; Text[50])
        {
            Caption = 'E-mail';
            DataClassification = ToBeClassified;
        }

        field(25; PreferredLanguage; Text[2])
        {
            Caption = 'Preferred language';
            DataClassification = ToBeClassified;
            TableRelation = AwsLanguage.ShortName;
        }

        field(30; Department; Text[50])
        {
            Caption = 'Department';
            DataClassification = ToBeClassified;
            TableRelation = if (PreferredLanguage = const('NL'))
                                SelectionListNL.SelectionContent where(SelectionGroupName = Const('Department'), ApplicationName = Const('KIP'))
            else
            if (PreferredLanguage = const('DE'))
                                SelectionListDE.SelectionContent where(SelectionGroupName = Const('Department'), ApplicationName = Const('KIP'))
            else
            if (PreferredLanguage = const('EN'))
                                SelectionListEN.SelectionContent where(SelectionGroupName = Const('Department'), ApplicationName = Const('KIP'));
        }
    }

    keys
    {
        key(PK; RecordNumber, FullName, PreferredLanguage)
        {
            Clustered = true;
        }
    }

    var
        myInt: Integer;
        PageLanguage: Record AwsLanguage;

    trigger OnInsert()
    begin
        PageLanguage.SetFilter(ShortName, 'NL');
        if (PageLanguage.FindFirst()) then
            PreferredLanguage := PageLanguage.ShortName;
    end;

    trigger OnModify()
    begin

    end;

    trigger OnDelete()
    begin

    end;

    trigger OnRename()
    begin

    end;
}

I hope someone is able to help me.

Kind regards,

Clemens Linders

I have the same question (0)
  • Suggested answer
    THE Italian Profile Picture
    Microsoft Employee on at

    This is currently not possible.

    Just FYI, first time I have heard this request was dated back to EMEA Directions in Prague (in 2016, probably) where partner was asking the same in relation of universal app (phone client). Actually this was not possible because some devices, when setting the focus anywhere in the app were throwing the keyboard automatically.

    That is why it has never been implemented up to now.

    This is a good candidate for IDEAS site. You could vote for some existing ones that have this problem in different flavors

    experience.dynamics.com/.../

  • Ebramhana Profile Picture
    on at

    Hello,

    Let me start by saying how great your work is I really learn a lot from you. 

    If you don't mind me asking this error appears to one of our users and one only, how come this error relates to bad data and only one user is getting the error?

    would you be able to provide any tips or tricks on how I can start troubleshooting the error for this specific user?

  • Clemens Linders Profile Picture
    70 on at

    Hi Ebramhana,

    I am afraid you responded to the wrong topic, I cannot place your question with regards to this topic.

    Kind regards,

    Clemens Linders

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,091 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,032 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 946 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans