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 152

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

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    157 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
    152 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
    233 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,419 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
    100,919 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,961 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,211 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,141

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans