web
You’re offline. This is a read only version of the page.
close
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;
        }
 
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,449 Super User 2025 Season 2 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
    95,763 Super User 2025 Season 2 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,380 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,116

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 764 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 635 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans