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

I need to do External Document No. as mandatory.

(0) ShareShare
ReportReport
Posted on by 156

Here when we going to insert lines in sales order without giving the value to the External Document No. then the External Document No. must show the error.

SalesLinesInsertion.PNG

  • Suggested answer
    JAngle Profile Picture
    159 on at

    Fairly sure testfield doesn’t require that as the if statement because it is testing for a value - which in this case has to be any text value.

    Could you not use standard setup here and save on development effort?

    1950BB32_2D00_2C7E_2D00_48DD_2D00_A2D8_2D00_8DED73258FEB.jpeg

  • Dyavari Sandeep Yadav Profile Picture
    156 on at

    Thanks for the reply. but it is only useful for the showing mandatory symbol. But my requirement is not that one. please check my description.

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

    Rather than putting it on page extension, why not put it on Codeunit 414 - Release Sales Document ?

    You can subscribe to event OnBeforeReleaseSalesDoc and put the TestField there.

    Yes, users can insert the line, but they will not be able to post or release the order without filling in External Document No.

  • Suggested answer
    Dallefeld Profile Picture
    235 User Group Leader on at

    Agree with Teddy H.

    Trying to force data entry errors are hard, if the user does not access the field, there is no test that happens. Release is the best place to test for errors.

    If your reason for the change is that you want the external document number on the lines, then your code at Release could validate that you have an external document number and if the lines are blank, it can populate the value.

  • Verified answer
    Saurav.Dhyani Profile Picture
    14,481 User Group Leader on at

    Agree with Teddy H.

    Additionally if you have to write this code (assuming you have to) then you should write on table OnBeforeInsert event.

  • Verified answer
    YUN ZHU Profile Picture
    103,717 Super User 2026 Season 2 on at

    Hi, For External Document No., please use the settings suggested by Josh. In the BC Demo database, Purchase Document is automatically enabled this, but for Sales Document, it is not enabled by default, so you may not notice it.

    For the customization of field mandatory, I hope the link below can give you some new inspiration.

    https://yzhums.com/4940/

    Thanks.

    ZHU

  • Verified answer
    tanya07 Profile Picture
    1,638 on at

    Hi,

    To top Teddy's reply, Please follow the same as below -

     [EventSubscriber(ObjectType::Codeunit, 414, 'OnBeforeReleaseSalesDoc', '', false, false)]
        local procedure MyProcedure(var SalesHeader: Record "Sales Header")

        begin

            SalesHeader.TestField(ExtDocNo);

        end;
    Thanks,
    Tanya Kharbanda
    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has a verified 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

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 676 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 483 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 310 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans