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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Mandatory field

(0) ShareShare
ReportReport
Posted on by 25

Hi

I am working with C/al and I have three fields 

1 Id code[20]

2 name text[50]

3 password text[50]

I have set notblank=true; for all the fields but it is only working for Id , It is not works for text type fields

Thanks

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Do you have some errors? It should work also for Text fields.

  • Verified answer
    Raju Gudipalli Profile Picture
    185 on at

    If the NotBlank property is used on other fields than primary fields, the behavior is as follows:

    • If the field is blank, and never entered, the page can be closed.

    • If the field has been entered, and the user tries to enter a blank value, a validation error occurs.

    Check this link. It may help you.

    https://docs.microsoft.com/en-us/dynamics-nav/notblank-property

  • rizwan5895 Profile Picture
    25 on at

    HI

    page getting close without any error

  • Verified answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,306 Super User 2026 Season 1 on at

    The NotBlank property doesn't work as you expected.

    It will only throw an error if your field is one of the primary keys.

    Otherwise, it will only throw an error when you try to input the field.

  • rizwan5895 Profile Picture
    25 on at

    Hi 

    Thanks for the reply 

    I understood what you said, but I want to make the fields mandatory, without any entry, page must not be close, how can i do this.

  • Verified answer
    Raju Gudipalli Profile Picture
    185 on at

    Try this.
    1. use oninsert trigger for testfield for the madatory fileds.
    2. you can set madatory for fields on page to identify all the fields that are mandatory to insert.
    3. Set notblank = true, this will check when the field modified.

  • Verified answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,306 Super User 2026 Season 1 on at

    You need to handle it manually by code. You can put the mandatory check on the Page trigger, such as OnClosePage.

    Depending on how the table is designed, you also need to put on the Table trigger, such as OnInsert and OnModify.

  • Tabrez Ajaz Profile Picture
    793 on at

    You can write the following code on page or table:

    Page level:

    OnInsertRecord(BelowxRec : Boolean) : Boolean

    IF (Name = '') OR (Password = '') THEN

     ERROR('required');

    OnModifyRecord() : Boolean

    IF (Name = '') OR (Password = '') THEN

     ERROR('required');

    Table level:

    OnInsert()

    IF (Name = '') OR (Password = '') THEN

     ERROR('required');

    OnModify()

    IF (Name = '') OR (Password = '') THEN

     ERROR('required');

  • rizwan5895 Profile Picture
    25 on at

    Thanks

  • Verified answer
    Tabrez Ajaz Profile Picture
    793 on at

    Did you tried above, if this not works for you and want more validation then you have to write code in OnQueryClosePage() trigger, so you can totally restrict the user for validation, so user can't able to close the page if everything not validated.

    Don't forget to verify the answer.

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

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 645 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 432 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 248 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans