Skip to main content

Notifications

Announcements

No record found.

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 210

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

  • Suggested answer
    NAV_with_Narang Profile Picture
    NAV_with_Narang 2,236 Super User 2024 Season 1 on at
    RE: 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 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

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: 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

    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
    Deekshitha Reddy Profile Picture
    Deekshitha Reddy 219 on at
    RE: 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

    You can use the property "Testfield".

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

    eg:Testfield("fieldname");

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans