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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

How can i apply A validation on General journal line such that if a field is left empty then request for approval cannot be sent and error msg should pop up

(0) ShareShare
ReportReport
Posted on by 234

How can i apply A validation on General journal line such that if a field is left empty then request for approval cannot be sent and error msg should pop up

I have the same question (0)
  • Suggested answer
    Deekshitha Reddy Profile Picture
    219 on at

    You can use the property "Testfield".

    On a button(action) or trigger OnValidate or trigger OnClosePage.

    eg:Testfield("fieldname");

  • Suggested answer
    Govinda Kumar Profile Picture
    2,310 Moderator on at

    Hi Pragya,

    First, I recommend you to set the "ShowMandatory" property on your page to "true", so that a user will know its important..

    pastedimage1682602485629v1.png

    If you want to validate the field so that the user cannot leave the page until they have entered a value, you can do so in the "OnQueryClosePage" trigger, see the following code

        trigger OnQueryClosePage(CloseAction: Action): Boolean
        begin
            if Rec.FieldName = '' then begin
                Error('The field ''Field Name'' must be filled in.');
            end;
        end;

    However, if you only want to validate the field when a request for approval is sent, you will need to write that validation code in one of the event in your codeunit. If you can provide more information about the specific page or action, I can help you locate the appropriate event in that codeunit.

    Regards

  • Suggested answer
    NAV_with_Narang Profile Picture
    2,390 Moderator on at

    I agree with People Eater's approach. It is user interactive and restrictive at the same time. Also TESTFIELD will give a very non user friendly error, best to prefer a custom error which explains the user what went wrong rather than user coming back to you on emails

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 621 Super User 2026 Season 1

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 445 Most Valuable Professional

#3
YUN ZHU Profile Picture

YUN ZHU 366 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans