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...
Suggested answer

How to make a field required

(0) ShareShare
ReportReport
Posted on 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
    485 on at
    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
    1,615 on at
    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
    63 on at
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,760 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans