Skip to main content
Post a question

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to make a field required

Posted on 27 Aug 2020 18:23:26 by 35

I can see in the AL that you can set the NotBlank field attribute to make a field required. If I was creating a custom field then I could make it required however I cannot modify this attribute on stock fields. I have a customer that would like a stock field made required. How can I make a work-around for this? I figure I would need to in a page extension create a OnInsert or OnUpdate validation logic but I don't see any documentation on how to do this properly.

  • Suggested answer
    Salah Eddine BENOUALA Profile Picture
    Salah Eddine BENOUALA 485 on 28 Aug 2020 at 18:14:19
    RE: How to make a field required

    Hi Andrew,

    You can give you field as parameter to TESTFIELD function where you want to control empty value. 

    If it is empty it will automatically trigger an error.

    TESTFIELD(stock);


    -----------------------------------------

    Best Regards,

    Salah Eddine BENOUALA

    Dynamics NAV & 365 Business Central Consultant

    Please verify my answer, if you find it helpful.

    Doing so you'll show others that there was found a solution and you credit my help.

  • tanya07 Profile Picture
    tanya07 1,554 on 28 Aug 2020 at 12:24:23
    RE: How to make a field required

    Hope this suggestion helps to make a field mandatory/required on page level , we could simply use OnQueryClosePage() trigger where you could use a logic like this :

    IF stock <> ' ' THEN

    ERROR('Fill the required field');

    END;

  • Suggested answer
    JAngle Profile Picture
    JAngle 33,159 on 27 Aug 2020 at 20:37:40
    RE: How to make a field required

    This post might be worth looking at: mohana-dynamicsnav.blogspot.com/.../how-to-modify-existing-field-and-action.html

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans