Skip to main content

Notifications

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

Posted on by 208

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,234 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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans