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