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...
Answered

how to validate if first name is empty then middle name not able to enter in the business central

(1) ShareShare
ReportReport
Posted on by 133
Can you please suggest me mentioned below codes are not working first name is blank then without any error msg middle name will accept.
 
 field(2; Studentfirstname; Text[100])
        {
            Caption = 'Student First Name';
            DataClassification = CustomerContent;
            trigger OnValidate()
            var
                myInt: Integer;
 
            begin
 
                Rec.Fullname := Rec.Studentfirstname + ' ' + Rec./student middle Name/ + ' ' + Rec.studentlastName;
                if (Rec.Studentfirstname = '') then
                begin
                       If (/student middle Name/<>'') then
                    begin
                        Error('You should Enter First Name');
                    end;
                end;
            end;
        }
 
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
    Hi @Ajay,
     
    I think you must add this code in "student middle name" validate method.
     
            field(XX; "student middle Name"; Text[100])
            {
                Caption = 'student middle Name';
                DataClassification = CustomerContent;
                trigger OnValidate() 
                begin
                    validate(Studentfirstname);
                end;
            }
    Also don't forget to add Rec.
     If (Rec."student middle Name"<>'') then
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    YUN ZHU Profile Picture
    101,414 Super User 2026 Season 1 on at
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: How to make a field mandatory
     
     
    Thanks.
    ZHU
  • Verified answer
    Saurav.Dhyani Profile Picture
    14,419 User Group Leader on at
    Hi,
     
    In Middle Name on validate trigger just write -
     
    If (rec.Studentmiddlename <> xrec.Studentmiddlename) or (rec.Studentmiddlename <> '') then 
     Rec.Testfield(Studentfirstname);
    Regards,
    Saurav Dhyani

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,216 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,471 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,369

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans