Skip to main content

Notifications

Announcements

No record found.

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;
        }
 
  • Verified answer
    Saurav.Dhyani Profile Picture
    14,312 Super User 2025 Season 1 on at
    how to validate if first name is empty then middle name not able to enter in the business central
    Hi,
     
    In Middle Name on validate trigger just write -
     
    If (rec.Studentmiddlename <> xrec.Studentmiddlename) or (rec.Studentmiddlename <> '') then 
     Rec.Testfield(Studentfirstname);
    Regards,
    Saurav Dhyani
  • Suggested answer
    YUN ZHU Profile Picture
    79,385 Super User 2025 Season 1 on at
    how to validate if first name is empty then middle name not able to enter in the business central
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: How to make a field mandatory
     
     
    Thanks.
    ZHU
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    17,879 Super User 2025 Season 1 on at
    how to validate if first name is empty then middle name not able to enter in the business central
    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,044 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans